DeviceManager/TsSFCDevice.Client.Launch/Common/CameraDialog.cs
2024-07-27 09:44:19 +08:00

48 lines
1.3 KiB
C#

using System;
using System.Drawing;
using DevExpress.XtraEditors;
using System.Windows.Forms;
namespace TsSFCDevice.Client.Launch.Common
{
public partial class CameraDialog : XtraForm
{
public Image CameraImage { get; set; }
public CameraDialog()
{
InitializeComponent();
}
private void CameraDialog_Load(object sender, EventArgs e)
{
cameraControl1.DeviceNotFoundString = "未能获取设备摄像头或摄像头处于禁用状态。";
if (cameraControl1.Device!= null && cameraControl1.Device.IsRunning)
{
btn_Photograph.Enabled = true;
}
}
/// <summary>
/// 拍照
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btn_Photograph_Click(object sender, EventArgs e)
{
CameraImage = cameraControl1.Device.TakeSnapshot();
this.DialogResult = DialogResult.OK;
}
/// <summary>
/// 取消
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btn_Cancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
}
}