相机格式更改

This commit is contained in:
Admin 2025-04-28 09:44:35 +08:00
parent 6a9e7e4343
commit bc0ed5d574
6 changed files with 167 additions and 87 deletions

View File

@ -3,6 +3,7 @@ using System.ComponentModel;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using AntdUI; using AntdUI;
using DH.Commons.Enums; using DH.Commons.Enums;
using DVPCameraType;
using HalconDotNet; using HalconDotNet;
using OpenCvSharp; using OpenCvSharp;
@ -47,11 +48,13 @@ namespace DH.Commons.Base
// 私有字段 + 带通知的属性与DetectionLabel风格一致 // 私有字段 + 带通知的属性与DetectionLabel风格一致
private bool _isEnabled = false; private bool _isEnabled = false;
private bool _isallPicEnabled = true;//默认全画幅 private bool _isallPicEnabled = true;//默认全画幅
private bool _isRGBEnabled = true;//默认彩色
private bool _isContinueMode = false; private bool _isContinueMode = false;
private bool _isSavePicEnabled = false; private bool _isSavePicEnabled = false;
private bool _isZoomCamera = false; private bool _isZoomCamera = false;
private string _imageSaveDirectory; private string _imageSaveDirectory;
private EnumCamType _CamType; private EnumCamType _CamType;
private dvpStreamFormat _dvpstreamFormat = dvpStreamFormat.S_RGB24;
private ImageFormat _imageFormat = ImageFormat.Jpeg; private ImageFormat _imageFormat = ImageFormat.Jpeg;
private bool _isHardwareTrigger = true; private bool _isHardwareTrigger = true;
private string _serialNumber = string.Empty; private string _serialNumber = string.Empty;
@ -71,6 +74,20 @@ namespace DH.Commons.Base
public volatile int SnapshotCount = 0; public volatile int SnapshotCount = 0;
[Category("相机设置")]
[DisplayName("图像格式")]
[Description("相机采集图像格式")]
public dvpStreamFormat DvpImageFormat
{
get => _dvpstreamFormat;
set
{
if (_dvpstreamFormat == value) return;
_dvpstreamFormat = value;
OnPropertyChanged(nameof(DvpImageFormat));
}
}
[Category("采图模式")] [Category("采图模式")]
[DisplayName("连续模式")] [DisplayName("连续模式")]
[Description("是否连续模式。true连续模式采图false触发模式采图")] [Description("是否连续模式。true连续模式采图false触发模式采图")]

View File

@ -27,6 +27,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="DVPCameraCS64">
<HintPath>..\X64\Debug\DVPCameraCS64.dll</HintPath>
</Reference>
<Reference Include="halcondotnet"> <Reference Include="halcondotnet">
<HintPath>..\x64\Debug\halcondotnet.dll</HintPath> <HintPath>..\x64\Debug\halcondotnet.dll</HintPath>
</Reference> </Reference>

View File

@ -27,7 +27,7 @@ namespace DH.Devices.Camera
public bool Connected=false; public bool Connected=false;
public int m_n_dev_count = 0; public int m_n_dev_count = 0;
private DVPCamera.dvpStreamCallback ImageCallback; private DVPCamera.dvpStreamCallback ImageCallback;
public dvpStreamFormat dvpStreamFormat = dvpStreamFormat.S_RGB24; // public dvpStreamFormat dvpStreamFormat = dvpStreamFormat.S_RGB24;
public int m_CamCount = 0; public int m_CamCount = 0;
public Double m_dfDisplayCount = 0; public Double m_dfDisplayCount = 0;
@ -63,6 +63,8 @@ namespace DH.Devices.Camera
{ {
try try
{ {
if (CameraName == "Cam1")
Console.WriteLine("");
pCallBackFunc = new DVPCamera.dvpEventCallback(cbExceptiondelegate); pCallBackFunc = new DVPCamera.dvpEventCallback(cbExceptiondelegate);
nRet = DVPCamera.dvpOpenByUserId(CameraName, nRet = DVPCamera.dvpOpenByUserId(CameraName,
dvpOpenMode.OPEN_NORMAL, dvpOpenMode.OPEN_NORMAL,
@ -74,7 +76,7 @@ namespace DH.Devices.Camera
throw new Exception($"Create device failed:{nRet:x8}"); throw new Exception($"Create device failed:{nRet:x8}");
} }
nRet = DVPCamera.dvpSetTargetFormat(m_handle, (dvpStreamFormat)dvpStreamFormat); nRet = DVPCamera.dvpSetTargetFormat(m_handle, (dvpStreamFormat)DvpImageFormat);
if (dvpStatus.DVP_STATUS_OK != nRet) if (dvpStatus.DVP_STATUS_OK != nRet)
{ {
throw new Exception($"Set image format failed:{nRet:x8}"); throw new Exception($"Set image format failed:{nRet:x8}");

View File

@ -524,6 +524,7 @@ namespace DHSoftware
cam.CameraIP = cameraBase.CameraIP; cam.CameraIP = cameraBase.CameraIP;
cam.IsEnabled = cameraBase.IsEnabled; cam.IsEnabled = cameraBase.IsEnabled;
cam.IsZoomCamera = cameraBase.IsZoomCamera; cam.IsZoomCamera = cameraBase.IsZoomCamera;
cam.DvpImageFormat = cameraBase.DvpImageFormat;
cam.Exposure = cameraBase.Exposure; cam.Exposure = cameraBase.Exposure;
cam.Gain = cameraBase.Gain; cam.Gain = cameraBase.Gain;
cam.RotateImage = cameraBase.RotateImage; cam.RotateImage = cameraBase.RotateImage;

View File

@ -29,11 +29,12 @@
private void InitializeComponent() private void InitializeComponent()
{ {
panel3 = new AntdUI.Panel(); panel3 = new AntdUI.Panel();
btnSizeAdd = new AntdUI.Button();
button1 = new AntdUI.Button();
button2 = new AntdUI.Button();
button3 = new AntdUI.Button(); button3 = new AntdUI.Button();
button2 = new AntdUI.Button();
button1 = new AntdUI.Button();
btnSizeAdd = new AntdUI.Button();
panel4 = new AntdUI.Panel(); panel4 = new AntdUI.Panel();
pictureBox1 = new PictureBox();
panel2 = new AntdUI.Panel(); panel2 = new AntdUI.Panel();
label18 = new AntdUI.Label(); label18 = new AntdUI.Label();
swhEnable = new AntdUI.Switch(); swhEnable = new AntdUI.Switch();
@ -65,12 +66,13 @@
label14 = new AntdUI.Label(); label14 = new AntdUI.Label();
switch1 = new AntdUI.Switch(); switch1 = new AntdUI.Switch();
panel1 = new AntdUI.Panel(); panel1 = new AntdUI.Panel();
pictureBox1 = new PictureBox(); sltPicType = new AntdUI.Select();
label15 = new AntdUI.Label();
panel3.SuspendLayout(); panel3.SuspendLayout();
panel4.SuspendLayout(); panel4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
panel2.SuspendLayout(); panel2.SuspendLayout();
panel1.SuspendLayout(); panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// panel3 // panel3
@ -80,51 +82,12 @@
panel3.Controls.Add(button1); panel3.Controls.Add(button1);
panel3.Controls.Add(btnSizeAdd); panel3.Controls.Add(btnSizeAdd);
panel3.Dock = DockStyle.Bottom; panel3.Dock = DockStyle.Bottom;
panel3.Location = new Point(0, 552); panel3.Location = new Point(0, 585);
panel3.Name = "panel3"; panel3.Name = "panel3";
panel3.Size = new Size(691, 59); panel3.Size = new Size(691, 59);
panel3.TabIndex = 39; panel3.TabIndex = 39;
panel3.Text = "panel3"; panel3.Text = "panel3";
// //
// btnSizeAdd
//
btnSizeAdd.BorderWidth = 2F;
btnSizeAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnSizeAdd.Ghost = true;
btnSizeAdd.IconRatio = 0F;
btnSizeAdd.IconSvg = "";
btnSizeAdd.Location = new Point(75, 13);
btnSizeAdd.Name = "btnSizeAdd";
btnSizeAdd.Size = new Size(80, 38);
btnSizeAdd.TabIndex = 43;
btnSizeAdd.Text = "连接相机";
//
// button1
//
button1.BorderWidth = 2F;
button1.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
button1.Ghost = true;
button1.IconRatio = 0F;
button1.IconSvg = "";
button1.Location = new Point(233, 13);
button1.Name = "button1";
button1.Size = new Size(80, 38);
button1.TabIndex = 44;
button1.Text = "断开相机";
//
// button2
//
button2.BorderWidth = 2F;
button2.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
button2.Ghost = true;
button2.IconRatio = 0F;
button2.IconSvg = "";
button2.Location = new Point(388, 13);
button2.Name = "button2";
button2.Size = new Size(80, 38);
button2.TabIndex = 45;
button2.Text = "单次触发";
//
// button3 // button3
// //
button3.BorderWidth = 2F; button3.BorderWidth = 2F;
@ -138,16 +101,65 @@
button3.TabIndex = 46; button3.TabIndex = 46;
button3.Text = "连续触发"; button3.Text = "连续触发";
// //
// button2
//
button2.BorderWidth = 2F;
button2.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
button2.Ghost = true;
button2.IconRatio = 0F;
button2.IconSvg = "";
button2.Location = new Point(388, 13);
button2.Name = "button2";
button2.Size = new Size(80, 38);
button2.TabIndex = 45;
button2.Text = "单次触发";
//
// button1
//
button1.BorderWidth = 2F;
button1.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
button1.Ghost = true;
button1.IconRatio = 0F;
button1.IconSvg = "";
button1.Location = new Point(233, 13);
button1.Name = "button1";
button1.Size = new Size(80, 38);
button1.TabIndex = 44;
button1.Text = "断开相机";
//
// btnSizeAdd
//
btnSizeAdd.BorderWidth = 2F;
btnSizeAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnSizeAdd.Ghost = true;
btnSizeAdd.IconRatio = 0F;
btnSizeAdd.IconSvg = "";
btnSizeAdd.Location = new Point(75, 13);
btnSizeAdd.Name = "btnSizeAdd";
btnSizeAdd.Size = new Size(80, 38);
btnSizeAdd.TabIndex = 43;
btnSizeAdd.Text = "连接相机";
//
// panel4 // panel4
// //
panel4.Controls.Add(pictureBox1); panel4.Controls.Add(pictureBox1);
panel4.Dock = DockStyle.Fill; panel4.Dock = DockStyle.Fill;
panel4.Location = new Point(0, 0); panel4.Location = new Point(0, 0);
panel4.Name = "panel4"; panel4.Name = "panel4";
panel4.Size = new Size(691, 552); panel4.Size = new Size(691, 585);
panel4.TabIndex = 40; panel4.TabIndex = 40;
panel4.Text = "panel4"; panel4.Text = "panel4";
// //
// pictureBox1
//
pictureBox1.BorderStyle = BorderStyle.FixedSingle;
pictureBox1.Dock = DockStyle.Fill;
pictureBox1.Location = new Point(0, 0);
pictureBox1.Name = "pictureBox1";
pictureBox1.Size = new Size(691, 585);
pictureBox1.TabIndex = 39;
pictureBox1.TabStop = false;
//
// panel2 // panel2
// //
panel2.Controls.Add(panel4); panel2.Controls.Add(panel4);
@ -155,7 +167,7 @@
panel2.Dock = DockStyle.Fill; panel2.Dock = DockStyle.Fill;
panel2.Location = new Point(218, 0); panel2.Location = new Point(218, 0);
panel2.Name = "panel2"; panel2.Name = "panel2";
panel2.Size = new Size(691, 611); panel2.Size = new Size(691, 644);
panel2.TabIndex = 49; panel2.TabIndex = 49;
panel2.Text = "panel2"; panel2.Text = "panel2";
// //
@ -172,7 +184,7 @@
swhEnable.CheckedText = "启用"; swhEnable.CheckedText = "启用";
swhEnable.Location = new Point(86, 9); swhEnable.Location = new Point(86, 9);
swhEnable.Name = "swhEnable"; swhEnable.Name = "swhEnable";
swhEnable.Size = new Size(94, 33); swhEnable.Size = new Size(111, 33);
swhEnable.TabIndex = 49; swhEnable.TabIndex = 49;
swhEnable.UnCheckedText = "关闭"; swhEnable.UnCheckedText = "关闭";
// //
@ -204,7 +216,7 @@
// //
iptExposure.Location = new Point(86, 136); iptExposure.Location = new Point(86, 136);
iptExposure.Name = "iptExposure"; iptExposure.Name = "iptExposure";
iptExposure.Size = new Size(94, 36); iptExposure.Size = new Size(111, 36);
iptExposure.TabIndex = 53; iptExposure.TabIndex = 53;
iptExposure.Tag = ""; iptExposure.Tag = "";
iptExposure.Text = "0"; iptExposure.Text = "0";
@ -213,7 +225,7 @@
// //
iptGain.Location = new Point(86, 179); iptGain.Location = new Point(86, 179);
iptGain.Name = "iptGain"; iptGain.Name = "iptGain";
iptGain.Size = new Size(94, 36); iptGain.Size = new Size(111, 36);
iptGain.TabIndex = 54; iptGain.TabIndex = 54;
iptGain.Text = "0"; iptGain.Text = "0";
// //
@ -223,7 +235,7 @@
iptRevolve.List = true; iptRevolve.List = true;
iptRevolve.Location = new Point(86, 222); iptRevolve.Location = new Point(86, 222);
iptRevolve.Name = "iptRevolve"; iptRevolve.Name = "iptRevolve";
iptRevolve.Size = new Size(94, 36); iptRevolve.Size = new Size(111, 36);
iptRevolve.TabIndex = 55; iptRevolve.TabIndex = 55;
// //
// label4 // label4
@ -239,7 +251,7 @@
sltAcquisitionMode.List = true; sltAcquisitionMode.List = true;
sltAcquisitionMode.Location = new Point(86, 265); sltAcquisitionMode.Location = new Point(86, 265);
sltAcquisitionMode.Name = "sltAcquisitionMode"; sltAcquisitionMode.Name = "sltAcquisitionMode";
sltAcquisitionMode.Size = new Size(94, 36); sltAcquisitionMode.Size = new Size(111, 36);
sltAcquisitionMode.TabIndex = 57; sltAcquisitionMode.TabIndex = 57;
// //
// label5 // label5
@ -255,12 +267,12 @@
sltTriggerMode.List = true; sltTriggerMode.List = true;
sltTriggerMode.Location = new Point(86, 310); sltTriggerMode.Location = new Point(86, 310);
sltTriggerMode.Name = "sltTriggerMode"; sltTriggerMode.Name = "sltTriggerMode";
sltTriggerMode.Size = new Size(94, 36); sltTriggerMode.Size = new Size(111, 36);
sltTriggerMode.TabIndex = 59; sltTriggerMode.TabIndex = 59;
// //
// label7 // label7
// //
label7.Location = new Point(3, 498); label7.Location = new Point(3, 538);
label7.Name = "label7"; label7.Name = "label7";
label7.Size = new Size(29, 23); label7.Size = new Size(29, 23);
label7.TabIndex = 60; label7.TabIndex = 60;
@ -268,34 +280,34 @@
// //
// iptROIX // iptROIX
// //
iptROIX.Location = new Point(86, 430); iptROIX.Location = new Point(86, 470);
iptROIX.Name = "iptROIX"; iptROIX.Name = "iptROIX";
iptROIX.Size = new Size(94, 37); iptROIX.Size = new Size(111, 37);
iptROIX.TabIndex = 61; iptROIX.TabIndex = 61;
iptROIX.Tag = ""; iptROIX.Tag = "";
iptROIX.Text = "0"; iptROIX.Text = "0";
// //
// iptROIY // iptROIY
// //
iptROIY.Location = new Point(86, 473); iptROIY.Location = new Point(86, 513);
iptROIY.Name = "iptROIY"; iptROIY.Name = "iptROIY";
iptROIY.Size = new Size(94, 37); iptROIY.Size = new Size(111, 37);
iptROIY.TabIndex = 62; iptROIY.TabIndex = 62;
iptROIY.Text = "0"; iptROIY.Text = "0";
// //
// iptROIW // iptROIW
// //
iptROIW.Location = new Point(86, 516); iptROIW.Location = new Point(86, 556);
iptROIW.Name = "iptROIW"; iptROIW.Name = "iptROIW";
iptROIW.Size = new Size(94, 37); iptROIW.Size = new Size(111, 37);
iptROIW.TabIndex = 63; iptROIW.TabIndex = 63;
iptROIW.Text = "0"; iptROIW.Text = "0";
// //
// iptROIH // iptROIH
// //
iptROIH.Location = new Point(86, 559); iptROIH.Location = new Point(86, 599);
iptROIH.Name = "iptROIH"; iptROIH.Name = "iptROIH";
iptROIH.Size = new Size(94, 37); iptROIH.Size = new Size(111, 37);
iptROIH.TabIndex = 64; iptROIH.TabIndex = 64;
iptROIH.Text = "0"; iptROIH.Text = "0";
// //
@ -312,13 +324,13 @@
sthPic.CheckedText = "启用"; sthPic.CheckedText = "启用";
sthPic.Location = new Point(86, 56); sthPic.Location = new Point(86, 56);
sthPic.Name = "sthPic"; sthPic.Name = "sthPic";
sthPic.Size = new Size(94, 33); sthPic.Size = new Size(111, 33);
sthPic.TabIndex = 66; sthPic.TabIndex = 66;
sthPic.UnCheckedText = "关闭"; sthPic.UnCheckedText = "关闭";
// //
// label8 // label8
// //
label8.Location = new Point(36, 430); label8.Location = new Point(36, 470);
label8.Name = "label8"; label8.Name = "label8";
label8.Size = new Size(29, 37); label8.Size = new Size(29, 37);
label8.TabIndex = 67; label8.TabIndex = 67;
@ -326,7 +338,7 @@
// //
// label9 // label9
// //
label9.Location = new Point(36, 473); label9.Location = new Point(36, 513);
label9.Name = "label9"; label9.Name = "label9";
label9.Size = new Size(29, 37); label9.Size = new Size(29, 37);
label9.TabIndex = 68; label9.TabIndex = 68;
@ -334,7 +346,7 @@
// //
// label10 // label10
// //
label10.Location = new Point(28, 516); label10.Location = new Point(28, 556);
label10.Name = "label10"; label10.Name = "label10";
label10.Size = new Size(44, 37); label10.Size = new Size(44, 37);
label10.TabIndex = 69; label10.TabIndex = 69;
@ -342,7 +354,7 @@
// //
// label11 // label11
// //
label11.Location = new Point(28, 560); label11.Location = new Point(28, 600);
label11.Name = "label11"; label11.Name = "label11";
label11.Size = new Size(44, 36); label11.Size = new Size(44, 36);
label11.TabIndex = 70; label11.TabIndex = 70;
@ -350,7 +362,7 @@
// //
// label12 // label12
// //
label12.Location = new Point(21, 362); label12.Location = new Point(21, 402);
label12.Name = "label12"; label12.Name = "label12";
label12.Size = new Size(59, 23); label12.Size = new Size(59, 23);
label12.TabIndex = 71; label12.TabIndex = 71;
@ -359,9 +371,9 @@
// sthAllPic // sthAllPic
// //
sthAllPic.CheckedText = "启用"; sthAllPic.CheckedText = "启用";
sthAllPic.Location = new Point(86, 352); sthAllPic.Location = new Point(86, 392);
sthAllPic.Name = "sthAllPic"; sthAllPic.Name = "sthAllPic";
sthAllPic.Size = new Size(94, 33); sthAllPic.Size = new Size(111, 33);
sthAllPic.TabIndex = 72; sthAllPic.TabIndex = 72;
sthAllPic.UnCheckedText = "关闭"; sthAllPic.UnCheckedText = "关闭";
// //
@ -378,12 +390,12 @@
sltCamType.List = true; sltCamType.List = true;
sltCamType.Location = new Point(86, 93); sltCamType.Location = new Point(86, 93);
sltCamType.Name = "sltCamType"; sltCamType.Name = "sltCamType";
sltCamType.Size = new Size(94, 36); sltCamType.Size = new Size(111, 36);
sltCamType.TabIndex = 74; sltCamType.TabIndex = 74;
// //
// label14 // label14
// //
label14.Location = new Point(21, 401); label14.Location = new Point(21, 441);
label14.Name = "label14"; label14.Name = "label14";
label14.Size = new Size(59, 23); label14.Size = new Size(59, 23);
label14.TabIndex = 75; label14.TabIndex = 75;
@ -392,14 +404,16 @@
// switch1 // switch1
// //
switch1.CheckedText = "启用"; switch1.CheckedText = "启用";
switch1.Location = new Point(86, 391); switch1.Location = new Point(86, 431);
switch1.Name = "switch1"; switch1.Name = "switch1";
switch1.Size = new Size(94, 33); switch1.Size = new Size(111, 33);
switch1.TabIndex = 76; switch1.TabIndex = 76;
switch1.UnCheckedText = "关闭"; switch1.UnCheckedText = "关闭";
// //
// panel1 // panel1
// //
panel1.Controls.Add(sltPicType);
panel1.Controls.Add(label15);
panel1.Controls.Add(switch1); panel1.Controls.Add(switch1);
panel1.Controls.Add(label14); panel1.Controls.Add(label14);
panel1.Controls.Add(sltCamType); panel1.Controls.Add(sltCamType);
@ -432,19 +446,25 @@
panel1.Dock = DockStyle.Left; panel1.Dock = DockStyle.Left;
panel1.Location = new Point(0, 0); panel1.Location = new Point(0, 0);
panel1.Name = "panel1"; panel1.Name = "panel1";
panel1.Size = new Size(218, 611); panel1.Size = new Size(218, 644);
panel1.TabIndex = 48; panel1.TabIndex = 48;
panel1.Text = "panel1"; panel1.Text = "panel1";
// //
// pictureBox1 // sltPicType
// //
pictureBox1.BorderStyle = BorderStyle.FixedSingle; sltPicType.List = true;
pictureBox1.Dock = DockStyle.Fill; sltPicType.Location = new Point(86, 352);
pictureBox1.Location = new Point(0, 0); sltPicType.Name = "sltPicType";
pictureBox1.Name = "pictureBox1"; sltPicType.Size = new Size(111, 36);
pictureBox1.Size = new Size(691, 552); sltPicType.TabIndex = 78;
pictureBox1.TabIndex = 39; //
pictureBox1.TabStop = false; // label15
//
label15.Location = new Point(21, 352);
label15.Name = "label15";
label15.Size = new Size(59, 36);
label15.TabIndex = 77;
label15.Text = "图片格式";
// //
// CameraControl // CameraControl
// //
@ -453,12 +473,12 @@
Controls.Add(panel2); Controls.Add(panel2);
Controls.Add(panel1); Controls.Add(panel1);
Name = "CameraControl"; Name = "CameraControl";
Size = new Size(909, 611); Size = new Size(909, 644);
panel3.ResumeLayout(false); panel3.ResumeLayout(false);
panel4.ResumeLayout(false); panel4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
panel2.ResumeLayout(false); panel2.ResumeLayout(false);
panel1.ResumeLayout(false); panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
ResumeLayout(false); ResumeLayout(false);
} }
@ -502,5 +522,7 @@
private AntdUI.Label label14; private AntdUI.Label label14;
private AntdUI.Switch switch1; private AntdUI.Switch switch1;
private AntdUI.Panel panel1; private AntdUI.Panel panel1;
private AntdUI.Select sltPicType;
private AntdUI.Label label15;
} }
} }

View File

@ -10,6 +10,7 @@ using System.Windows.Forms;
using AntdUI; using AntdUI;
using DH.Commons.Base; using DH.Commons.Base;
using DH.Commons.Enums; using DH.Commons.Enums;
using DVPCameraType;
using static System.Windows.Forms.VisualStyles.VisualStyleElement; using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using Window = AntdUI.Window; using Window = AntdUI.Window;
@ -26,9 +27,36 @@ namespace DHSoftware.Views
InitializeComponent(); InitializeComponent();
sltCamType.TextChanged += SltCamTpye_TextChanged; sltCamType.TextChanged += SltCamTpye_TextChanged;
sltPicType.TextChanged += SltPicTpye_TextChanged;
InitData(); InitData();
BindData(); BindData();
} }
private void SltPicTpye_TextChanged(object? sender, EventArgs e)
{
if (sender is Select slt && !string.IsNullOrEmpty(slt.Text))
{
// 将文本转换为枚举值
if (Enum.TryParse<dvpStreamFormat>(slt.Text, out var plcType))
{
switch (plcType)
{
case dvpStreamFormat.S_RGB24:
case dvpStreamFormat.S_MONO8:
break;
default:
break;
}
}
else
{
}
}
}
private void SltCamTpye_TextChanged(object? sender, EventArgs e) private void SltCamTpye_TextChanged(object? sender, EventArgs e)
{ {
if (sender is Select slt && !string.IsNullOrEmpty(slt.Text)) if (sender is Select slt && !string.IsNullOrEmpty(slt.Text))
@ -77,6 +105,7 @@ namespace DHSoftware.Views
{ {
sltCamType.DataBindings.Add("Text", CameraBase, "CamType", true, DataSourceUpdateMode.OnPropertyChanged, ""); sltCamType.DataBindings.Add("Text", CameraBase, "CamType", true, DataSourceUpdateMode.OnPropertyChanged, "");
sltPicType.DataBindings.Add("Text", CameraBase, "DvpImageFormat", true, DataSourceUpdateMode.OnPropertyChanged, "");
sthPic.DataBindings.Add(nameof(sthPic.Checked), CameraBase, nameof(CameraBase.IsSavePicEnabled), sthPic.DataBindings.Add(nameof(sthPic.Checked), CameraBase, nameof(CameraBase.IsSavePicEnabled),
true, DataSourceUpdateMode.OnPropertyChanged); true, DataSourceUpdateMode.OnPropertyChanged);
sthAllPic.DataBindings.Add(nameof(sthAllPic.Checked), CameraBase, nameof(CameraBase.IsAllPicEnabled), sthAllPic.DataBindings.Add(nameof(sthAllPic.Checked), CameraBase, nameof(CameraBase.IsAllPicEnabled),
@ -126,9 +155,15 @@ namespace DHSoftware.Views
{ {
sltCamType.Items.Add(value.ToString()); sltCamType.Items.Add(value.ToString());
} }
sltPicType.Items.Clear();
foreach (dvpStreamFormat value in Enum.GetValues(typeof(dvpStreamFormat)))
{
sltPicType.Items.Add(value.ToString());
}
// 初始化下拉框选项 // 初始化下拉框选项
sltAcquisitionMode.Items.AddRange(new[] { "连续模式", "触发模式" }); sltAcquisitionMode.Items.AddRange(new[] { "连续模式", "触发模式" });
sltTriggerMode.Items.AddRange(new[] { "软触发", "硬触发" }); sltTriggerMode.Items.AddRange(new[] { "软触发", "硬触发" });
// 设置初始选择 // 设置初始选择
sltAcquisitionMode.SelectedIndex = CameraBase.IsContinueMode ? 0 : 1; sltAcquisitionMode.SelectedIndex = CameraBase.IsContinueMode ? 0 : 1;