上传界面显示

This commit is contained in:
2025-03-16 13:11:08 +08:00
parent ca6476b87c
commit c49c45d6e4
62 changed files with 9095 additions and 1204 deletions

View File

@ -21,6 +21,7 @@
<ItemGroup>
<PackageReference Include="AntdUI" Version="1.9.3" />
<PackageReference Include="System.IO.Ports" Version="9.0.2" />
@ -31,6 +32,7 @@
<ProjectReference Include="..\DH.Devices.Motion\DH.Devices.Motion.csproj" />
<ProjectReference Include="..\DH.Devices.PLC\DH.Devices.PLC.csproj" />
<ProjectReference Include="..\DH.Devices.Vision\DH.Devices.Vision.csproj" />
<ProjectReference Include="..\DH.UI.Model.Winform\DH.UI.Model.Winform.csproj" />
</ItemGroup>
<ItemGroup>

View File

@ -50,7 +50,7 @@
splitContainer1 = new SplitContainer();
splitContainer2 = new SplitContainer();
tabImgDisplay = new AntdUI.Tabs();
tabPage1 = new AntdUI.TabPage();
tabMain = new AntdUI.TabPage();
tabsStas = new AntdUI.Tabs();
tabPage3 = new AntdUI.TabPage();
richTextBox1 = new RichTextBox();
@ -124,6 +124,7 @@
buttonSZ.Radius = 0;
buttonSZ.Size = new Size(50, 40);
buttonSZ.TabIndex = 0;
buttonSZ.Visible = false;
buttonSZ.WaveSize = 0;
//
// pageHeader1
@ -142,7 +143,7 @@
// label1
//
label1.AutoSize = true;
label1.Location = new Point(709, 10);
label1.Location = new Point(979, 10);
label1.Name = "label1";
label1.Size = new Size(64, 21);
label1.TabIndex = 1;
@ -240,23 +241,23 @@
//
// tabImgDisplay
//
tabImgDisplay.Controls.Add(tabPage1);
tabImgDisplay.Controls.Add(tabMain);
tabImgDisplay.Dock = DockStyle.Fill;
tabImgDisplay.Location = new Point(0, 0);
tabImgDisplay.Name = "tabImgDisplay";
tabImgDisplay.Pages.Add(tabPage1);
tabImgDisplay.Pages.Add(tabMain);
tabImgDisplay.Size = new Size(580, 320);
tabImgDisplay.Style = styleCard1;
tabImgDisplay.TabIndex = 1;
tabImgDisplay.Text = "tabs1";
//
// tabPage1
// tabMain
//
tabPage1.Location = new Point(3, 28);
tabPage1.Name = "tabPage1";
tabPage1.Size = new Size(574, 289);
tabPage1.TabIndex = 0;
tabPage1.Text = "检测";
tabMain.Location = new Point(3, 28);
tabMain.Name = "tabMain";
tabMain.Size = new Size(574, 289);
tabMain.TabIndex = 0;
tabMain.Text = "检测";
//
// tabsStas
//
@ -452,7 +453,7 @@
private SplitContainer splitContainer1;
private SplitContainer splitContainer2;
private AntdUI.Tabs tabImgDisplay;
private AntdUI.TabPage tabPage1;
private AntdUI.TabPage tabMain;
private AntdUI.Tabs tabsStas;
private AntdUI.TabPage tabPage3;
private RichTextBox richTextBox1;

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Microsoft ResX Schema
Version 2.0
@ -48,7 +48,7 @@
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter

View File

@ -0,0 +1,196 @@
namespace XKRS.UI.Device.Winform
{
partial class CtrlVisionDisplay
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.ctmsVisibleControl = new System.Windows.Forms.ContextMenuStrip(this.components);
this.tsmiShowToolBar = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiShowImageSwitch = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiShowStatusBar = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiShowOpConfig = new System.Windows.Forms.ToolStripMenuItem();
this.gBox = new System.Windows.Forms.GroupBox();
this.tscImageSwitch = new System.Windows.Forms.ToolStripContainer();
this.chkShowDefect = new System.Windows.Forms.CheckBox();
this.chkShowOrigin = new System.Windows.Forms.CheckBox();
this.plMain = new System.Windows.Forms.Panel();
this.ctmsVisibleControl.SuspendLayout();
this.gBox.SuspendLayout();
this.tscImageSwitch.ContentPanel.SuspendLayout();
this.tscImageSwitch.SuspendLayout();
this.SuspendLayout();
//
// ctmsVisibleControl
//
this.ctmsVisibleControl.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmiShowToolBar,
this.tsmiShowImageSwitch,
this.tsmiShowStatusBar,
this.tsmiShowOpConfig});
this.ctmsVisibleControl.Name = "ctmsVisibleControl";
this.ctmsVisibleControl.Size = new System.Drawing.Size(149, 92);
//
// tsmiShowToolBar
//
this.tsmiShowToolBar.CheckOnClick = true;
this.tsmiShowToolBar.Name = "tsmiShowToolBar";
this.tsmiShowToolBar.Size = new System.Drawing.Size(148, 22);
this.tsmiShowToolBar.Text = "显示工具栏";
this.tsmiShowToolBar.CheckedChanged += new System.EventHandler(this.tsmiShowToolBar_CheckedChanged);
//
// tsmiShowImageSwitch
//
this.tsmiShowImageSwitch.CheckOnClick = true;
this.tsmiShowImageSwitch.Name = "tsmiShowImageSwitch";
this.tsmiShowImageSwitch.Size = new System.Drawing.Size(148, 22);
this.tsmiShowImageSwitch.Text = "显示图像开关";
this.tsmiShowImageSwitch.CheckedChanged += new System.EventHandler(this.tsmiShowOpBar_CheckedChanged);
//
// tsmiShowStatusBar
//
this.tsmiShowStatusBar.CheckOnClick = true;
this.tsmiShowStatusBar.Name = "tsmiShowStatusBar";
this.tsmiShowStatusBar.Size = new System.Drawing.Size(148, 22);
this.tsmiShowStatusBar.Text = "显示状态栏";
this.tsmiShowStatusBar.CheckedChanged += new System.EventHandler(this.tsmiShowStatusBar_CheckedChanged);
//
// tsmiShowOpConfig
//
this.tsmiShowOpConfig.CheckOnClick = true;
this.tsmiShowOpConfig.Name = "tsmiShowOpConfig";
this.tsmiShowOpConfig.Size = new System.Drawing.Size(148, 22);
this.tsmiShowOpConfig.Text = "显示操作配置";
this.tsmiShowOpConfig.CheckedChanged += new System.EventHandler(this.tsmiShowOpConfig_CheckedChanged);
//
// gBox
//
this.gBox.Controls.Add(this.tscImageSwitch);
this.gBox.Controls.Add(this.plMain);
this.gBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.gBox.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.gBox.Location = new System.Drawing.Point(0, 0);
this.gBox.Name = "gBox";
this.gBox.Size = new System.Drawing.Size(596, 488);
this.gBox.TabIndex = 2;
this.gBox.TabStop = false;
this.gBox.Text = "groupBox1";
//
// tscImageSwitch
//
this.tscImageSwitch.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tscImageSwitch.BottomToolStripPanelVisible = false;
//
// tscImageSwitch.ContentPanel
//
this.tscImageSwitch.ContentPanel.BackColor = System.Drawing.Color.Transparent;
this.tscImageSwitch.ContentPanel.Controls.Add(this.chkShowDefect);
this.tscImageSwitch.ContentPanel.Controls.Add(this.chkShowOrigin);
this.tscImageSwitch.ContentPanel.Margin = new System.Windows.Forms.Padding(0);
this.tscImageSwitch.ContentPanel.Size = new System.Drawing.Size(202, 24);
this.tscImageSwitch.LeftToolStripPanelVisible = false;
this.tscImageSwitch.Location = new System.Drawing.Point(78, 13);
this.tscImageSwitch.Name = "tscImageSwitch";
this.tscImageSwitch.RightToolStripPanelVisible = false;
this.tscImageSwitch.Size = new System.Drawing.Size(202, 24);
this.tscImageSwitch.TabIndex = 3;
this.tscImageSwitch.Text = "toolStripContainer2";
this.tscImageSwitch.TopToolStripPanelVisible = false;
this.tscImageSwitch.Visible = false;
//
// chkShowDefect
//
this.chkShowDefect.AutoSize = true;
this.chkShowDefect.Checked = true;
this.chkShowDefect.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkShowDefect.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.chkShowDefect.Location = new System.Drawing.Point(3, 3);
this.chkShowDefect.Name = "chkShowDefect";
this.chkShowDefect.Size = new System.Drawing.Size(74, 18);
this.chkShowDefect.TabIndex = 0;
this.chkShowDefect.Text = "显示缺陷";
this.chkShowDefect.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.chkShowDefect.TextImageRelation = System.Windows.Forms.TextImageRelation.TextAboveImage;
this.chkShowDefect.UseVisualStyleBackColor = true;
this.chkShowDefect.CheckedChanged += new System.EventHandler(this.chkShowDefect_CheckedChanged);
//
// chkShowOrigin
//
this.chkShowOrigin.AutoSize = true;
this.chkShowOrigin.Checked = true;
this.chkShowOrigin.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkShowOrigin.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.chkShowOrigin.Location = new System.Drawing.Point(83, 3);
this.chkShowOrigin.Name = "chkShowOrigin";
this.chkShowOrigin.Size = new System.Drawing.Size(74, 18);
this.chkShowOrigin.TabIndex = 1;
this.chkShowOrigin.Text = "显示原图";
this.chkShowOrigin.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.chkShowOrigin.TextImageRelation = System.Windows.Forms.TextImageRelation.TextAboveImage;
this.chkShowOrigin.UseVisualStyleBackColor = true;
this.chkShowOrigin.CheckedChanged += new System.EventHandler(this.chkShowOrigin_CheckedChanged);
//
// plMain
//
this.plMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.plMain.Location = new System.Drawing.Point(3, 18);
this.plMain.Name = "plMain";
this.plMain.Size = new System.Drawing.Size(590, 467);
this.plMain.TabIndex = 0;
//
// CtrlDetectionDisplay
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ContextMenuStrip = this.ctmsVisibleControl;
this.Controls.Add(this.gBox);
this.Name = "CtrlDetectionDisplay";
this.Size = new System.Drawing.Size(596, 488);
this.ctmsVisibleControl.ResumeLayout(false);
this.gBox.ResumeLayout(false);
this.tscImageSwitch.ContentPanel.ResumeLayout(false);
this.tscImageSwitch.ContentPanel.PerformLayout();
this.tscImageSwitch.ResumeLayout(false);
this.tscImageSwitch.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ContextMenuStrip ctmsVisibleControl;
private System.Windows.Forms.ToolStripMenuItem tsmiShowToolBar;
private System.Windows.Forms.ToolStripMenuItem tsmiShowImageSwitch;
private System.Windows.Forms.ToolStripMenuItem tsmiShowStatusBar;
private System.Windows.Forms.GroupBox gBox;
private System.Windows.Forms.Panel plMain;
private System.Windows.Forms.ToolStripMenuItem tsmiShowOpConfig;
private System.Windows.Forms.ToolStripContainer tscImageSwitch;
private System.Windows.Forms.CheckBox chkShowDefect;
private System.Windows.Forms.CheckBox chkShowOrigin;
}
}

View File

@ -0,0 +1,172 @@

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using DH.Commons.Enums;
using DH.UI.Model.Winform;
namespace XKRS.UI.Device.Winform
{
public partial class CtrlVisionDisplay : UserControl
{
public Canvas CvImage { get; set; }
public bool IsShowPreTreatedImage { get; set; } = true;
public bool IsShowDefectImage { get; set; } = true;
public Bitmap CurrBitmap { get; set; }
public List<IShapeElement> CurrDetectionResults { get; set; } = new List<IShapeElement>();
public event Action<bool> OnShowOpConfigMenuStateChanged;
public CtrlVisionDisplay()
{
InitializeComponent();
CvImage = new Canvas();
CvImage.IsShowElementList = false;
CvImage.IsShowROITool = false;
CvImage.Dock = DockStyle.Fill;
CvImage.ContextMenuStrip = ctmsVisibleControl;
plMain.Controls.Add(CvImage);
InitialToolBarVisible();
this.Load += ((s, e) =>
{
gBox.Text = DetectionName;
});
}
public string DetectionId { get; set; }
public string DetectionName { get; set; }
public int RowIndex { get; set; }
public int ColIndex { get; set; }
public void RefreshDetectionResult(Bitmap image, List<IShapeElement> detectionResults)
{
try
{
if (image == null)
return;
CurrBitmap = image;
if (detectionResults != null)
{
CurrDetectionResults = new List<IShapeElement>(detectionResults);
}
if (CvImage.IsHandleCreated)
{
CvImage.Elements.Clear();
if (IsShowPreTreatedImage)
{
CvImage.LoadImage(image);
}
else
{
//加载一张同样大小的 空白图
Bitmap newImage = new Bitmap(image.Width, image.Height);
using (Graphics grp = Graphics.FromImage(newImage))
{
grp.FillRectangle(Brushes.White, 0, 0, newImage.Width, newImage.Height);
}
CvImage.LoadImage(newImage);
}
if (IsShowDefectImage && detectionResults != null)
{
detectionResults.ForEach(e => CvImage.Elements.Add(e));
}
}
}
catch (Exception ex)
{
}
}
#region
private void chkShowDefect_CheckedChanged(object sender, EventArgs e)
{
IsShowDefectImage = chkShowDefect.Checked;
RefreshDetectionResult(CurrBitmap, CurrDetectionResults);
}
private void chkShowOrigin_CheckedChanged(object sender, EventArgs e)
{
IsShowPreTreatedImage = chkShowOrigin.Checked;
RefreshDetectionResult(CurrBitmap, CurrDetectionResults);
}
#endregion
#region
public bool IsShowOperationBar
{
get => tscImageSwitch.Visible;
set => tsmiShowImageSwitch.Checked = tscImageSwitch.Visible = value;
}
public bool IsShowToolBar
{
get => CvImage.IsShowToolBar;
set => tsmiShowToolBar.Checked = CvImage.IsShowToolBar = value;
}
public bool IsShowStatusBar
{
get => CvImage.IsShowStatusBar;
set => tsmiShowStatusBar.Checked = CvImage.IsShowStatusBar = value;
}
private bool isShowOpConfig = false;
public bool IsShowOpConfig
{
get => tsmiShowOpConfig.Checked;
set
{
if (tsmiShowOpConfig.Checked != value)
{
tsmiShowOpConfig.Checked = value;
}
OnShowOpConfigMenuStateChanged?.Invoke(value);
}
}
private void tsmiShowOpConfig_CheckedChanged(object sender, EventArgs e)
{
IsShowOpConfig = tsmiShowOpConfig.Checked;
}
private void InitialToolBarVisible()
{
IsShowOperationBar = IsShowToolBar = IsShowStatusBar = false;
}
private void tsmiShowToolBar_CheckedChanged(object sender, EventArgs e)
{
IsShowToolBar = tsmiShowToolBar.Checked;
}
private void tsmiShowOpBar_CheckedChanged(object sender, EventArgs e)
{
IsShowOperationBar = tsmiShowImageSwitch.Checked;
}
private void tsmiShowStatusBar_CheckedChanged(object sender, EventArgs e)
{
IsShowStatusBar = tsmiShowStatusBar.Checked;
}
#endregion
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ctmsVisibleControl.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>44, 19</value>
</metadata>
</root>

View File

@ -0,0 +1,174 @@

namespace XKRS.UI.Device.Winform
{
partial class CtrlVisionRunBase
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.tableDisplay = new System.Windows.Forms.TableLayoutPanel();
this.tlpOpConfig = new System.Windows.Forms.TableLayoutPanel();
this.propOpConfig = new System.Windows.Forms.PropertyGrid();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.btnExecuteOpConfig = new System.Windows.Forms.Button();
this.btnBatchRun = new System.Windows.Forms.Button();
this.splitCMain = new System.Windows.Forms.SplitContainer();
this.tlpOpConfig.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitCMain)).BeginInit();
this.splitCMain.Panel1.SuspendLayout();
this.splitCMain.Panel2.SuspendLayout();
this.splitCMain.SuspendLayout();
this.SuspendLayout();
//
// tableDisplay
//
this.tableDisplay.ColumnCount = 2;
this.tableDisplay.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableDisplay.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableDisplay.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableDisplay.Location = new System.Drawing.Point(0, 0);
this.tableDisplay.Name = "tableDisplay";
this.tableDisplay.RowCount = 2;
this.tableDisplay.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableDisplay.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableDisplay.Size = new System.Drawing.Size(769, 251);
this.tableDisplay.TabIndex = 0;
//
// tlpOpConfig
//
this.tlpOpConfig.ColumnCount = 1;
this.tlpOpConfig.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tlpOpConfig.Controls.Add(this.propOpConfig, 0, 1);
this.tlpOpConfig.Controls.Add(this.flowLayoutPanel1, 0, 0);
this.tlpOpConfig.Dock = System.Windows.Forms.DockStyle.Fill;
this.tlpOpConfig.Location = new System.Drawing.Point(0, 0);
this.tlpOpConfig.Name = "tlpOpConfig";
this.tlpOpConfig.RowCount = 2;
this.tlpOpConfig.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F));
this.tlpOpConfig.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tlpOpConfig.Size = new System.Drawing.Size(769, 247);
this.tlpOpConfig.TabIndex = 0;
//
// propOpConfig
//
this.propOpConfig.Dock = System.Windows.Forms.DockStyle.Fill;
this.propOpConfig.Location = new System.Drawing.Point(3, 38);
this.propOpConfig.Name = "propOpConfig";
this.propOpConfig.Size = new System.Drawing.Size(763, 206);
this.propOpConfig.TabIndex = 1;
this.propOpConfig.ToolbarVisible = false;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Controls.Add(this.btnExecuteOpConfig);
this.flowLayoutPanel1.Controls.Add(this.btnBatchRun);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(769, 35);
this.flowLayoutPanel1.TabIndex = 2;
//
// btnExecuteOpConfig
//
this.btnExecuteOpConfig.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnExecuteOpConfig.BackColor = System.Drawing.SystemColors.GradientActiveCaption;
this.btnExecuteOpConfig.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExecuteOpConfig.Font = new System.Drawing.Font("微软雅黑", 12F);
this.btnExecuteOpConfig.Location = new System.Drawing.Point(598, 3);
this.btnExecuteOpConfig.Margin = new System.Windows.Forms.Padding(5, 3, 5, 3);
this.btnExecuteOpConfig.MinimumSize = new System.Drawing.Size(1, 1);
this.btnExecuteOpConfig.Name = "btnExecuteOpConfig";
this.btnExecuteOpConfig.Size = new System.Drawing.Size(166, 30);
this.btnExecuteOpConfig.TabIndex = 0;
this.btnExecuteOpConfig.Text = "执行当前配置操作";
this.btnExecuteOpConfig.UseVisualStyleBackColor = false;
// this.btnExecuteOpConfig.Click += new System.EventHandler(this.btnExecuteOpConfig_Click);
//
// btnBatchRun
//
this.btnBatchRun.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBatchRun.BackColor = System.Drawing.SystemColors.Info;
this.btnBatchRun.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnBatchRun.Font = new System.Drawing.Font("微软雅黑", 12F);
this.btnBatchRun.Location = new System.Drawing.Point(488, 3);
this.btnBatchRun.Margin = new System.Windows.Forms.Padding(5, 3, 5, 3);
this.btnBatchRun.MinimumSize = new System.Drawing.Size(1, 1);
this.btnBatchRun.Name = "btnBatchRun";
this.btnBatchRun.Size = new System.Drawing.Size(100, 30);
this.btnBatchRun.TabIndex = 0;
this.btnBatchRun.Text = "批量检测";
this.btnBatchRun.UseVisualStyleBackColor = false;
// this.btnBatchRun.Click += new System.EventHandler(this.btnBatchRun_Click);
//
// splitCMain
//
this.splitCMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitCMain.Location = new System.Drawing.Point(0, 0);
this.splitCMain.Name = "splitCMain";
this.splitCMain.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitCMain.Panel1
//
this.splitCMain.Panel1.Controls.Add(this.tableDisplay);
//
// splitCMain.Panel2
//
this.splitCMain.Panel2.Controls.Add(this.tlpOpConfig);
this.splitCMain.Size = new System.Drawing.Size(769, 502);
this.splitCMain.SplitterDistance = 251;
this.splitCMain.TabIndex = 2;
//
// CtrlVisionRunBase
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitCMain);
this.Name = "CtrlVisionRunBase";
this.Size = new System.Drawing.Size(769, 502);
this.tlpOpConfig.ResumeLayout(false);
this.flowLayoutPanel1.ResumeLayout(false);
this.splitCMain.Panel1.ResumeLayout(false);
this.splitCMain.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitCMain)).EndInit();
this.splitCMain.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableDisplay;
private System.Windows.Forms.TableLayoutPanel tlpOpConfig;
private System.Windows.Forms.Button btnExecuteOpConfig;
private System.Windows.Forms.PropertyGrid propOpConfig;
private System.Windows.Forms.SplitContainer splitCMain;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Button btnBatchRun;
}
}

View File

@ -0,0 +1,249 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using DH.Commons.Enums;
using DH.Devices.Devices;
namespace XKRS.UI.Device.Winform
{
public partial class CtrlVisionRunBase : UserControl
{
private DateTime LastDisplayTime = DateTime.MinValue;
//public CtrlVisionRunBase()
//{
// InitializeComponent();
//}
//private object OnUpdateBatchNO(ISubscriber arg1, object arg2, object arg3)
//{
// //获取BatchNO
// if (arg2 is string batchNo)
// {
// ML.BatchNO = string.IsNullOrEmpty(batchNo) ? "OFFline_" + DateTime.Now.ToString("yyyyMMdd") : batchNo;
// }
// return null;
//}
public CtrlVisionRunBase(VisionEngineBase device)
{
InitializeComponent();
Device = device;
InitialLayout();
this.Load += (s, e) =>
{
ML.OnDetectionDone -= ML_OnDetectionDone;
ML.OnDetectionDone += ML_OnDetectionDone;
};
// PubSubCenter.GetInstance().RemoveSubscribers(PubSubCenterMessageType.UpdateBatchNO.ToString());
// PubSubCenter.GetInstance().Subscribe(PubSubCenterMessageType.UpdateBatchNO.ToString(), OnUpdateBatchNO);
}
private async void ML_OnDetectionDone(string detectionId, Bitmap image, List<IShapeElement> detectionResults)
{
await Task.Run(() =>
{
if (!this.IsHandleCreated)
return;
this.Invoke(new Action(() =>
{
if (this.IsDisposed)
return;
var display = displayList.FirstOrDefault(u => u.DetectionId == detectionId);
if (display != null)
{
display.RefreshDetectionResult(image, detectionResults);
}
}));
});
}
public VisionEngineBase Device { get; set; }
protected VisionEngineBase ML
{
get => Device as VisionEngineBase;
}
//VisionEngineInitialConfigBase IConfig => ML?.InitialConfig as VisionEngineInitialConfigBase;
//VisionEngineOperationConfigBase OpConfig = new VisionEngineOperationConfigBase();
//private void btnExecuteOpConfig_Click(object sender, EventArgs e)
//{
// try
// {
// PubSubCenter.GetInstance().Publish(PubSubCenterMessageType.RequestBatchNO.ToString(), null, null);
// var msg = ML.RunWrap(OpConfig);
// if (msg.Result != 1)
// {
// MessageBox.Show(msg.Message);
// }
// }
// catch (Exception ex)
// {
// MessageBox.Show(ex.GetExceptionMessage());
// }
//}
#region Layout
int rows = 1;
int cols = 1;
public int Rows
{
get => rows;
set
{
if (value <= 1)
{
rows = 1;
}
else
{
rows = value;
}
}
}
public int Cols
{
get => cols;
set
{
if (value <= 1)
{
cols = 1;
}
else
{
cols = value;
}
}
}
List<CtrlVisionDisplay> displayList = null;
private void InitialLayout()
{
if (ML.DetectionConfigs.Count == 0)
{
return;
}
var locations = ML.DetectionConfigs.Select(u => u.ShowLocation).ToList();
if (locations.Count > 0)
{
Rows = (int)locations.Max(u => u.Y);
Cols = (int)locations.Max(u => u.X);
}
tableDisplay.ColumnCount = Cols;
tableDisplay.RowCount = Rows;
tableDisplay.ColumnStyles.Clear();
for (int i = 0; i < Cols; i++)
{
ColumnStyle colStyle = new ColumnStyle();
colStyle.SizeType = SizeType.Percent;
colStyle.Width = 1.0f / (float)Cols;
tableDisplay.ColumnStyles.Add(colStyle);
}
tableDisplay.RowStyles.Clear();
for (int i = 0; i < Rows; i++)
{
RowStyle rowStyle = new RowStyle();
rowStyle.SizeType = SizeType.Percent;
rowStyle.Height = 1.0f / (float)Rows;
tableDisplay.RowStyles.Add(rowStyle);
}
tableDisplay.Controls.Clear();
displayList = new List<CtrlVisionDisplay>();
ML.DetectionConfigs.ForEach(d =>
{
//if (!d.IsShowInUI)
// return;
CtrlVisionDisplay display = new CtrlVisionDisplay();
display.DetectionId = d.Id;
display.DetectionName = d.Name;
display.RowIndex = (int)d.ShowLocation.Y - 1;
display.ColIndex = (int)d.ShowLocation.X - 1;
//display.RowIndex = (int)count%row;
//display.ColIndex = (int)count / row;
display.Dock = DockStyle.Fill;
display.OnShowOpConfigMenuStateChanged -= Display_OnShowOpConfigMenuStateChanged;
display.OnShowOpConfigMenuStateChanged += Display_OnShowOpConfigMenuStateChanged;
displayList.Add(display);
tableDisplay.Controls.Add(display);
tableDisplay.SetCellPosition(display, new TableLayoutPanelCellPosition(display.ColIndex, display.RowIndex));
});
splitCMain.Panel2Collapsed = true;
// propOpConfig.SelectedObject = OpConfig;
}
private void Display_OnShowOpConfigMenuStateChanged(bool isVisible)
{
IsShowOpConfig = isVisible;
}
public bool IsShowOpConfig
{
get => !splitCMain.Panel2Collapsed;
set
{
if (splitCMain.Panel2Collapsed == value)
{
splitCMain.Panel2Collapsed = !value;
displayList.ForEach(d => d.IsShowOpConfig = value);
}
}
}
#endregion
//private void btnBatchRun_Click(object sender, EventArgs e)
//{
// FrmMLBatchRun frmMLBatchRun = new FrmMLBatchRun(Device);
// frmMLBatchRun.MdiParent = (this.Parent as DeviceRunFrmBase).MdiParent;
// frmMLBatchRun.DockPanel = (this.Parent as DeviceRunFrmBase).DockPanel;
// frmMLBatchRun.DockState = DockState.Document;
// frmMLBatchRun.Text = $"{Device.Name}_批量检测";
// frmMLBatchRun.Show();
//}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -29,6 +29,13 @@
private void InitializeComponent()
{
panel1 = new AntdUI.Panel();
select_Result = new AntdUI.Select();
label5 = new AntdUI.Label();
input_maxArea = new AntdUI.InputNumber();
label3 = new AntdUI.Label();
input_minArea = new AntdUI.InputNumber();
label4 = new AntdUI.Label();
input_maxScore = new AntdUI.InputNumber();
label2 = new AntdUI.Label();
input_minScore = new AntdUI.InputNumber();
label1 = new AntdUI.Label();
@ -38,13 +45,6 @@
stackPanel1 = new AntdUI.StackPanel();
button_cancel = new AntdUI.Button();
button_ok = new AntdUI.Button();
input_maxScore = new AntdUI.InputNumber();
input_maxArea = new AntdUI.InputNumber();
label3 = new AntdUI.Label();
input_minArea = new AntdUI.InputNumber();
label4 = new AntdUI.Label();
label5 = new AntdUI.Label();
select_Result = new AntdUI.Select();
panel1.SuspendLayout();
stackPanel1.SuspendLayout();
SuspendLayout();
@ -74,6 +74,87 @@
panel1.TabIndex = 0;
panel1.Text = "panel1";
//
// select_Result
//
select_Result.Dock = DockStyle.Top;
select_Result.Location = new Point(18, 408);
select_Result.Name = "select_Result";
select_Result.Size = new Size(464, 41);
select_Result.TabIndex = 27;
select_Result.Text = "select1";
//
// label5
//
label5.Dock = DockStyle.Top;
label5.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label5.Location = new Point(18, 384);
label5.Name = "label5";
label5.Size = new Size(464, 24);
label5.TabIndex = 25;
label5.Text = "标签结果";
//
// input_maxArea
//
input_maxArea.Dock = DockStyle.Top;
input_maxArea.Font = new Font("Microsoft YaHei UI", 9F);
input_maxArea.Increment = new decimal(new int[] { 10, 0, 0, 0 });
input_maxArea.Location = new Point(18, 346);
input_maxArea.Maximum = new decimal(new int[] { 999999999, 0, 0, 0 });
input_maxArea.Minimum = new decimal(new int[] { 0, 0, 0, 0 });
input_maxArea.Name = "input_maxArea";
input_maxArea.Radius = 3;
input_maxArea.Size = new Size(464, 38);
input_maxArea.TabIndex = 24;
input_maxArea.Text = "0";
//
// label3
//
label3.Dock = DockStyle.Top;
label3.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label3.Location = new Point(18, 322);
label3.Name = "label3";
label3.Size = new Size(464, 24);
label3.TabIndex = 23;
label3.Text = "最大面积";
//
// input_minArea
//
input_minArea.Dock = DockStyle.Top;
input_minArea.Font = new Font("Microsoft YaHei UI", 9F);
input_minArea.Increment = new decimal(new int[] { 10, 0, 0, 0 });
input_minArea.Location = new Point(18, 284);
input_minArea.Maximum = new decimal(new int[] { 999999999, 0, 0, 0 });
input_minArea.Minimum = new decimal(new int[] { 0, 0, 0, 0 });
input_minArea.Name = "input_minArea";
input_minArea.Radius = 3;
input_minArea.Size = new Size(464, 38);
input_minArea.TabIndex = 22;
input_minArea.Text = "0";
//
// label4
//
label4.Dock = DockStyle.Top;
label4.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label4.Location = new Point(18, 260);
label4.Name = "label4";
label4.Size = new Size(464, 24);
label4.TabIndex = 21;
label4.Text = "最小面积";
//
// input_maxScore
//
input_maxScore.Dock = DockStyle.Top;
input_maxScore.Font = new Font("Microsoft YaHei UI", 9F);
input_maxScore.Increment = new decimal(new int[] { 1, 0, 0, 65536 });
input_maxScore.Location = new Point(18, 222);
input_maxScore.Maximum = new decimal(new int[] { 1, 0, 0, 0 });
input_maxScore.Minimum = new decimal(new int[] { 0, 0, 0, 0 });
input_maxScore.Name = "input_maxScore";
input_maxScore.Radius = 3;
input_maxScore.Size = new Size(464, 38);
input_maxScore.TabIndex = 20;
input_maxScore.Text = "0";
//
// label2
//
label2.Dock = DockStyle.Top;
@ -96,7 +177,7 @@
input_minScore.Radius = 3;
input_minScore.Size = new Size(464, 38);
input_minScore.TabIndex = 18;
input_minScore.Text = "0.3";
input_minScore.Text = "0";
//
// label1
//
@ -169,86 +250,6 @@
button_ok.Text = "Submit";
button_ok.Type = AntdUI.TTypeMini.Primary;
//
// input_maxScore
//
input_maxScore.Dock = DockStyle.Top;
input_maxScore.Font = new Font("Microsoft YaHei UI", 9F);
input_maxScore.Increment = new decimal(new int[] { 1, 0, 0, 65536 });
input_maxScore.Location = new Point(18, 222);
input_maxScore.Maximum = new decimal(new int[] { 1, 0, 0, 0 });
input_maxScore.Minimum = new decimal(new int[] { 0, 0, 0, 0 });
input_maxScore.Name = "input_maxScore";
input_maxScore.Radius = 3;
input_maxScore.Size = new Size(464, 38);
input_maxScore.TabIndex = 20;
input_maxScore.Text = "0";
//
// input_maxArea
//
input_maxArea.Dock = DockStyle.Top;
input_maxArea.Font = new Font("Microsoft YaHei UI", 9F);
input_maxArea.Increment = new decimal(new int[] { 10, 0, 0, 0 });
input_maxArea.Location = new Point(18, 346);
input_maxArea.Maximum = new decimal(new int[] { 999999999, 0, 0, 0 });
input_maxArea.Minimum = new decimal(new int[] { 0, 0, 0, 0 });
input_maxArea.Name = "input_maxArea";
input_maxArea.Radius = 3;
input_maxArea.Size = new Size(464, 38);
input_maxArea.TabIndex = 24;
input_maxArea.Text = "0";
//
// label3
//
label3.Dock = DockStyle.Top;
label3.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label3.Location = new Point(18, 322);
label3.Name = "label3";
label3.Size = new Size(464, 24);
label3.TabIndex = 23;
label3.Text = "最大面积";
//
// input_minArea
//
input_minArea.Dock = DockStyle.Top;
input_minArea.Font = new Font("Microsoft YaHei UI", 9F);
input_minArea.Increment = new decimal(new int[] { 10, 0, 0, 0 });
input_minArea.Location = new Point(18, 284);
input_minArea.Maximum = new decimal(new int[] { 999999999, 0, 0, 0 });
input_minArea.Minimum = new decimal(new int[] { 0, 0, 0, 0 });
input_minArea.Name = "input_minArea";
input_minArea.Radius = 3;
input_minArea.Size = new Size(464, 38);
input_minArea.TabIndex = 22;
input_minArea.Text = "0";
//
// label4
//
label4.Dock = DockStyle.Top;
label4.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label4.Location = new Point(18, 260);
label4.Name = "label4";
label4.Size = new Size(464, 24);
label4.TabIndex = 21;
label4.Text = "最小面积";
//
// label5
//
label5.Dock = DockStyle.Top;
label5.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label5.Location = new Point(18, 384);
label5.Name = "label5";
label5.Size = new Size(464, 24);
label5.TabIndex = 25;
label5.Text = "标签结果";
//
// select_Result
//
select_Result.Location = new Point(21, 414);
select_Result.Name = "select_Result";
select_Result.Size = new Size(458, 41);
select_Result.TabIndex = 27;
select_Result.Text = "select1";
//
// DefectRowEdit
//
Controls.Add(panel1);

View File

@ -42,7 +42,7 @@ namespace AntdUIDemo.Views.Table
if (String.IsNullOrEmpty(input_name.Text))
{
input_name.Status = AntdUI.TType.Error;
AntdUI.Message.warn(window, "姓名不能为空!", autoClose: 3);
AntdUI.Message.warn(window, "标签不能为空!", autoClose: 3);
return;
}
user.LabelDescription = input_name.Text;
@ -57,6 +57,9 @@ namespace AntdUIDemo.Views.Table
input_name.Text = user.LabelDescription;
// input_addr.Text = user.Address;
input_minScore.Value =(decimal) user.ScoreMinValue;
input_maxScore.Value =(decimal) user.ScoreMaxValue;
input_minArea.Value =(decimal) user.ScoreMaxValue;
input_maxScore.Value =(decimal) user.ScoreMaxValue;
}
}
}

View File

@ -29,90 +29,211 @@
private void InitializeComponent()
{
panel1 = new Panel();
panel3 = new Panel();
label6 = new AntdUI.Label();
cbxDetectType = new AntdUI.Select();
label1 = new AntdUI.Label();
tbDetectName = new AntdUI.Input();
btnPreOpen = new AntdUI.Button();
tbModelpath = new AntdUI.Input();
button3 = new AntdUI.Button();
switchEnable = new AntdUI.Switch();
label8 = new AntdUI.Label();
label10 = new AntdUI.Label();
sthPic = new AntdUI.Switch();
sthSaveNGPic = new AntdUI.Switch();
label7 = new AntdUI.Label();
label9 = new AntdUI.Label();
swSaveOKPic = new AntdUI.Switch();
panel2 = new Panel();
label2 = new Label();
label2 = new AntdUI.Label();
buttonDEL = new AntdUI.Button();
table_base = new AntdUI.Table();
buttonADD = new AntdUI.Button();
label10 = new AntdUI.Label();
sthSaveNGPic = new AntdUI.Switch();
label9 = new AntdUI.Label();
swSaveOKPic = new AntdUI.Switch();
label7 = new AntdUI.Label();
sthPic = new AntdUI.Switch();
label8 = new AntdUI.Label();
switchEnable = new AntdUI.Switch();
tbDetectName = new TextBox();
label6 = new AntdUI.Label();
cbxDetectType = new ComboBox();
label5 = new AntdUI.Label();
btnPreOpen = new AntdUI.Button();
tbModelpath = new TextBox();
label1 = new AntdUI.Label();
panel1.SuspendLayout();
panel3.SuspendLayout();
panel2.SuspendLayout();
SuspendLayout();
//
// panel1
//
panel1.BorderStyle = BorderStyle.FixedSingle;
panel1.Controls.Add(button3);
panel1.Controls.Add(panel3);
panel1.Controls.Add(panel2);
panel1.Controls.Add(label10);
panel1.Controls.Add(sthSaveNGPic);
panel1.Controls.Add(label9);
panel1.Controls.Add(swSaveOKPic);
panel1.Controls.Add(label7);
panel1.Controls.Add(sthPic);
panel1.Controls.Add(label8);
panel1.Controls.Add(switchEnable);
panel1.Controls.Add(tbDetectName);
panel1.Controls.Add(label6);
panel1.Controls.Add(cbxDetectType);
panel1.Controls.Add(label5);
panel1.Controls.Add(btnPreOpen);
panel1.Controls.Add(tbModelpath);
panel1.Controls.Add(label1);
panel1.Dock = DockStyle.Fill;
panel1.Location = new Point(0, 0);
panel1.Name = "panel1";
panel1.Size = new Size(683, 445);
panel1.Size = new Size(600, 445);
panel1.TabIndex = 0;
//
// panel3
//
panel3.Controls.Add(label6);
panel3.Controls.Add(cbxDetectType);
panel3.Controls.Add(label1);
panel3.Controls.Add(tbDetectName);
panel3.Controls.Add(btnPreOpen);
panel3.Controls.Add(tbModelpath);
panel3.Controls.Add(button3);
panel3.Controls.Add(switchEnable);
panel3.Controls.Add(label8);
panel3.Controls.Add(label10);
panel3.Controls.Add(sthPic);
panel3.Controls.Add(sthSaveNGPic);
panel3.Controls.Add(label7);
panel3.Controls.Add(label9);
panel3.Controls.Add(swSaveOKPic);
panel3.Dock = DockStyle.Fill;
panel3.Location = new Point(0, 0);
panel3.Name = "panel3";
panel3.Size = new Size(598, 206);
panel3.TabIndex = 41;
//
// label6
//
label6.Location = new Point(3, 15);
label6.Name = "label6";
label6.Size = new Size(58, 23);
label6.TabIndex = 25;
label6.Text = "检测名称";
//
// cbxDetectType
//
cbxDetectType.Anchor = AnchorStyles.Top | AnchorStyles.Right;
cbxDetectType.Location = new Point(341, 7);
cbxDetectType.Name = "cbxDetectType";
cbxDetectType.Size = new Size(226, 31);
cbxDetectType.TabIndex = 40;
//
// label1
//
label1.Location = new Point(3, 44);
label1.Name = "label1";
label1.Size = new Size(73, 23);
label1.TabIndex = 9;
label1.Text = "模型路径";
//
// tbDetectName
//
tbDetectName.Location = new Point(82, 7);
tbDetectName.Name = "tbDetectName";
tbDetectName.Size = new Size(249, 31);
tbDetectName.TabIndex = 39;
//
// btnPreOpen
//
btnPreOpen.Anchor = AnchorStyles.Top | AnchorStyles.Right;
btnPreOpen.Location = new Point(507, 36);
btnPreOpen.MinimumSize = new Size(20, 0);
btnPreOpen.Name = "btnPreOpen";
btnPreOpen.Size = new Size(60, 31);
btnPreOpen.TabIndex = 22;
btnPreOpen.Text = "...";
//
// tbModelpath
//
tbModelpath.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
tbModelpath.Location = new Point(82, 36);
tbModelpath.Name = "tbModelpath";
tbModelpath.Size = new Size(415, 31);
tbModelpath.TabIndex = 38;
//
// button3
//
button3.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
button3.Location = new Point(538, 70);
button3.Anchor = AnchorStyles.Top | AnchorStyles.Right;
button3.Location = new Point(385, 73);
button3.Name = "button3";
button3.Size = new Size(115, 34);
button3.Size = new Size(182, 34);
button3.TabIndex = 37;
button3.Text = "查看文件夹";
//
// switchEnable
//
switchEnable.Location = new Point(82, 84);
switchEnable.Name = "switchEnable";
switchEnable.Size = new Size(60, 23);
switchEnable.TabIndex = 27;
switchEnable.Text = "switch1";
//
// label8
//
label8.Location = new Point(3, 84);
label8.Name = "label8";
label8.Size = new Size(58, 23);
label8.TabIndex = 28;
label8.Text = "模型启用";
//
// label10
//
label10.Location = new Point(176, 113);
label10.Name = "label10";
label10.Size = new Size(73, 23);
label10.TabIndex = 34;
label10.Text = "保存NG原图";
//
// sthPic
//
sthPic.Location = new Point(263, 84);
sthPic.Name = "sthPic";
sthPic.Size = new Size(60, 23);
sthPic.TabIndex = 29;
sthPic.Text = "switch2";
//
// sthSaveNGPic
//
sthSaveNGPic.Location = new Point(263, 113);
sthSaveNGPic.Name = "sthSaveNGPic";
sthSaveNGPic.Size = new Size(60, 23);
sthSaveNGPic.TabIndex = 33;
sthSaveNGPic.Text = "switch4";
//
// label7
//
label7.Location = new Point(184, 84);
label7.Name = "label7";
label7.Size = new Size(58, 23);
label7.TabIndex = 30;
label7.Text = "数据保存";
//
// label9
//
label9.Location = new Point(3, 113);
label9.Name = "label9";
label9.Size = new Size(73, 23);
label9.TabIndex = 32;
label9.Text = "保存OK原图";
//
// swSaveOKPic
//
swSaveOKPic.Location = new Point(82, 113);
swSaveOKPic.Name = "swSaveOKPic";
swSaveOKPic.Size = new Size(60, 23);
swSaveOKPic.TabIndex = 31;
swSaveOKPic.Text = "switch3";
//
// panel2
//
panel2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
panel2.Controls.Add(label2);
panel2.Controls.Add(buttonDEL);
panel2.Controls.Add(table_base);
panel2.Controls.Add(buttonADD);
panel2.Location = new Point(17, 141);
panel2.Dock = DockStyle.Bottom;
panel2.Location = new Point(0, 206);
panel2.Name = "panel2";
panel2.Size = new Size(639, 286);
panel2.Size = new Size(598, 237);
panel2.TabIndex = 35;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(3, 5);
label2.Location = new Point(3, 3);
label2.Name = "label2";
label2.Size = new Size(56, 17);
label2.TabIndex = 25;
label2.Size = new Size(58, 23);
label2.TabIndex = 29;
label2.Text = "模型参数";
//
// buttonDEL
//
buttonDEL.Location = new Point(93, 25);
buttonDEL.Location = new Point(93, 28);
buttonDEL.Name = "buttonDEL";
buttonDEL.Size = new Size(84, 34);
buttonDEL.TabIndex = 24;
@ -121,152 +242,30 @@
// table_base
//
table_base.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
table_base.Location = new Point(3, 65);
table_base.Location = new Point(0, 68);
table_base.Name = "table_base";
table_base.Size = new Size(633, 218);
table_base.Size = new Size(598, 169);
table_base.TabIndex = 22;
table_base.Text = "table1";
//
// buttonADD
//
buttonADD.Location = new Point(3, 25);
buttonADD.Location = new Point(3, 28);
buttonADD.Name = "buttonADD";
buttonADD.Size = new Size(84, 34);
buttonADD.TabIndex = 23;
buttonADD.Text = "新增";
//
// label10
//
label10.Location = new Point(171, 99);
label10.Name = "label10";
label10.Size = new Size(73, 23);
label10.TabIndex = 34;
label10.Text = "保存NG原图";
//
// sthSaveNGPic
//
sthSaveNGPic.Location = new Point(258, 99);
sthSaveNGPic.Name = "sthSaveNGPic";
sthSaveNGPic.Size = new Size(57, 23);
sthSaveNGPic.TabIndex = 33;
sthSaveNGPic.Text = "switch4";
//
// label9
//
label9.Location = new Point(17, 99);
label9.Name = "label9";
label9.Size = new Size(73, 23);
label9.TabIndex = 32;
label9.Text = "保存OK原图";
//
// swSaveOKPic
//
swSaveOKPic.Location = new Point(96, 99);
swSaveOKPic.Name = "swSaveOKPic";
swSaveOKPic.Size = new Size(57, 23);
swSaveOKPic.TabIndex = 31;
swSaveOKPic.Text = "switch3";
//
// label7
//
label7.Location = new Point(179, 70);
label7.Name = "label7";
label7.Size = new Size(58, 23);
label7.TabIndex = 30;
label7.Text = "数据保存";
//
// sthPic
//
sthPic.Location = new Point(258, 70);
sthPic.Name = "sthPic";
sthPic.Size = new Size(57, 23);
sthPic.TabIndex = 29;
sthPic.Text = "switch2";
//
// label8
//
label8.Location = new Point(17, 70);
label8.Name = "label8";
label8.Size = new Size(58, 23);
label8.TabIndex = 28;
label8.Text = "模型启用";
//
// switchEnable
//
switchEnable.Location = new Point(96, 70);
switchEnable.Name = "switchEnable";
switchEnable.Size = new Size(57, 23);
switchEnable.TabIndex = 27;
switchEnable.Text = "switch1";
//
// tbDetectName
//
tbDetectName.Location = new Point(96, 12);
tbDetectName.Name = "tbDetectName";
tbDetectName.Size = new Size(211, 23);
tbDetectName.TabIndex = 26;
//
// label6
//
label6.Location = new Point(17, 12);
label6.Name = "label6";
label6.Size = new Size(58, 23);
label6.TabIndex = 25;
label6.Text = "检测名称";
//
// cbxDetectType
//
cbxDetectType.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
cbxDetectType.DropDownStyle = ComboBoxStyle.DropDownList;
cbxDetectType.FormattingEnabled = true;
cbxDetectType.Location = new Point(402, 10);
cbxDetectType.Name = "cbxDetectType";
cbxDetectType.Size = new Size(254, 25);
cbxDetectType.TabIndex = 24;
//
// label5
//
label5.Location = new Point(333, 12);
label5.Name = "label5";
label5.Size = new Size(73, 23);
label5.TabIndex = 23;
label5.Text = "目标类型";
//
// btnPreOpen
//
btnPreOpen.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
btnPreOpen.Location = new Point(613, 41);
btnPreOpen.Name = "btnPreOpen";
btnPreOpen.Size = new Size(43, 23);
btnPreOpen.TabIndex = 22;
btnPreOpen.Text = "...";
//
// tbModelpath
//
tbModelpath.Location = new Point(96, 41);
tbModelpath.Name = "tbModelpath";
tbModelpath.Size = new Size(511, 23);
tbModelpath.TabIndex = 17;
//
// label1
//
label1.Location = new Point(17, 41);
label1.Name = "label1";
label1.Size = new Size(73, 23);
label1.TabIndex = 9;
label1.Text = "模型路径";
//
// DetectConfigControl
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(panel1);
Name = "DetectConfigControl";
Size = new Size(683, 445);
Size = new Size(600, 445);
panel1.ResumeLayout(false);
panel1.PerformLayout();
panel3.ResumeLayout(false);
panel2.ResumeLayout(false);
panel2.PerformLayout();
ResumeLayout(false);
}
@ -274,11 +273,7 @@
private Panel panel1;
private AntdUI.Label label1;
private TextBox tbModelpath;
private TextBox tbDetectName;
private AntdUI.Label label6;
private ComboBox cbxDetectType;
private AntdUI.Label label5;
private AntdUI.Button btnPreOpen;
private AntdUI.Label label7;
private AntdUI.Switch sthPic;
@ -289,10 +284,14 @@
private AntdUI.Label label9;
private AntdUI.Switch swSaveOKPic;
private Panel panel2;
private Label label2;
private AntdUI.Button buttonDEL;
private AntdUI.Table table_base;
private AntdUI.Button buttonADD;
private AntdUI.Button button3;
private AntdUI.Input tbDetectName;
private AntdUI.Input tbModelpath;
private AntdUI.Label label2;
private AntdUI.Select cbxDetectType;
private Panel panel3;
}
}

View File

@ -1,5 +1,6 @@
using AntdUI;
using AntdUIDemo.Views.Table;
using DH.Commons.Enums;
using DH.Devices.Vision;
using DHSoftware.Models;
using System;
@ -148,12 +149,12 @@ namespace DHSoftware.Views
},
new ColumnSwitch("IsEnable", "是否启用", ColumnAlign.Center){
//支持点击回调
Call= (value,record, i_row, i_col) =>{
//执行耗时操作
Thread.Sleep(1000);
// AntdUI.Message.info(window, value.ToString(),autoClose:1);
return value;
}
//Call= (value,record, i_row, i_col) =>{
// //执行耗时操作
// Thread.Sleep(10);
// // AntdUI.Message.info(window, value.ToString(),autoClose:1);
// return value;
//}
},
new Column("ScoreMinValue", "最小得分",ColumnAlign.Center),
new Column("ScoreMaxValue", "最大得分",ColumnAlign.Center),
@ -222,7 +223,12 @@ namespace DHSoftware.Views
{
DefectRow useradd = new DefectRow()
{
LabelDescription="xinquexian"
LabelDescription="xinquexian",
IsEnable=true,
ScoreMinValue=0.3,
ScoreMaxValue=1,
AreaMinValue=1,
AreaMaxValue=999999999,
};
var form = new DefectRowEdit(_window, useradd) { Size = new Size(700, 500) };
@ -361,87 +367,87 @@ namespace DHSoftware.Views
//表格内部按钮事件
private void Table_base_CellButtonClick(object sender, TableButtonEventArgs e)
{
//var buttontext = e.Btn.Text;
var buttontext = e.Btn.Text;
//if (e.Record is User user)
//{
// curUser = user;
// switch (buttontext)
// {
// //暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
// case "编辑":
// var form = new UserEdit(window, user) { Size = new Size(500, 300) };
// AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
// {
// OnLoad = () =>
// {
// AntdUI.Message.info(window, "进入编辑", autoClose: 1);
// },
// OnClose = () =>
// {
// AntdUI.Message.info(window, "结束编辑", autoClose: 1);
// }
// });
// break;
// case "删除":
// var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
// if (result == DialogResult.OK)
// antList.Remove(user);
// break;
// case "AntdUI":
// //超链接内容
// AntdUI.Message.info(window, user.CellLinks.FirstOrDefault().Id, autoClose: 1);
// break;
// case "查看图片":
// //使用clone可以防止table中的image被修改
// Preview.open(new Preview.Config(window, (Image)curUser.CellImages[0].Image.Clone()));
// break;
// }
//}
if (e.Record is DefectRow user)
{
curUser = user;
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new DefectRowEdit(_window, user) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(_window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(_window, "进入编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(_window, "结束编辑", autoClose: 1);
}
});
break;
case "删除":
var result = Modal.open(_window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
antList.Remove(user);
break;
case "AntdUI":
//超链接内容
// AntdUI.Message.info(_window, user.CellLinks.FirstOrDefault().Id, autoClose: 1);
break;
case "查看图片":
//使用clone可以防止table中的image被修改
// Preview.open(new Preview.Config(window, (Image)curUser.CellImages[0].Image.Clone()));
break;
}
}
}
private void ButtonDEL_Click(object sender, EventArgs e)
{
//if (antList.Count == 0 || !antList.Any(x => x.Selected))
//{
// bool isSubSelected = false;
// // 判断子元素是否勾选
// for (int i = 0; i < antList.Count; i++)
// {
// if (antList[i].Users != null && antList[i].Users.Any(x => x.Selected))
// {
// isSubSelected = true;
// break;
// }
// }
// if (!isSubSelected)
// {
// AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
// return;
// }
//}
if (antList.Count == 0 || !antList.Any(x => x.Selected))
{
bool isSubSelected = false;
//// 判断子元素是否勾选
//for (int i = 0; i < antList.Count; i++)
//{
// if (antList[i].Users != null && antList[i].Users.Any(x => x.Selected))
// {
// isSubSelected = true;
// break;
// }
//}
if (!isSubSelected)
{
AntdUI.Message.warn(_window, "请选择要删除的行!", autoClose: 3);
return;
}
}
//var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
//if (result == DialogResult.OK)
//{
// // 使用反转for循环删除主列表中选中的项
// for (int i = antList.Count - 1; i >= 0; i--)
// {
// // 删除选中的主列表项
// if (antList[i].Selected)
// {
// antList.RemoveAt(i);
// }
// else
// {
// // 删除子列表中选中的项
// antList[i].Users = antList[i].Users?.Where(user => !user.Selected).ToArray();
// }
// }
// // 提示删除完成
// // AntdUI.Message.success(this.w, "删除成功!", autoClose: 3);
// MessageBox.Show("删除成功!");
//}
var result = Modal.open(_window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
// 使用反转for循环删除主列表中选中的项
for (int i = antList.Count - 1; i >= 0; i--)
{
// 删除选中的主列表项
if (antList[i].Selected)
{
antList.RemoveAt(i);
}
else
{
// 删除子列表中选中的项
// antList[i].Users = antList[i].Users?.Where(user => !user.Selected).ToArray();
}
}
// 提示删除完成
// AntdUI.Message.success(this.w, "删除成功!", autoClose: 3);
MessageBox.Show("删除成功!");
}
}

View File

@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AntdUI;
using DH.Commons.Enums;
using DH.Devices.Devices;
using DH.Devices.Vision;

View File

@ -1,5 +1,6 @@
using AntdUI;
using AntdUIDemo.Models;
using DH.Commons.Enums;
using DH.Devices.Devices;
using DH.Devices.Vision;
using System;
@ -198,8 +199,8 @@ namespace DHSoftware.Views
int width = tabs.Width;
int height = tabs.Height;
// 创建新 TabPage
UserDetetion control = new UserDetetion(width, height);
control._windows = Window;
UserDetetion control = new UserDetetion(Window,width, height);
// control._windows = Window;
switch (name)
{
case "工位1":

View File

@ -17,9 +17,10 @@ namespace DHSoftware.Views
private StackPanel panel, panel2, panel3, panel4;
public Window _windows;
//根据检测配置 将对应的相机配置、中处理预处理、尺寸测量
public UserDetetion(int parentWidth, int parentHeight)
public UserDetetion(Window windows,int parentWidth, int parentHeight)
{
InitializeComponent();
_windows = windows;
AntdUI.CollapseItem group1 = new CollapseItem();
group1.Height = parentHeight / 4;
group1.Text = "相机配置";
@ -214,7 +215,7 @@ namespace DHSoftware.Views
// 遍历 panel 的 Controls找到最后一个 CameraConfigControl 并移除
for (int i = panel3.Controls.Count - 1; i >= 0; i--)
{
if (panel3.Controls[i] is CameraConfigControl)
if (panel3.Controls[i] is DetectConfigControl)
{
panel3.Controls.RemoveAt(i);
break; // 只删除一个

View File

@ -1,4 +1,5 @@
using DH.Devices.Vision;
using DH.Commons.Enums;
using DH.Devices.Vision;
using System;
using System.Collections.Generic;
using System.Linq;