尺寸测量功能界面

This commit is contained in:
2025-03-16 17:32:09 +08:00
parent 0ac00af0ad
commit 25cd61c5cb
63 changed files with 12697 additions and 36 deletions

View File

@ -74,9 +74,18 @@
iptPath2 = new AntdUI.Input();
label8 = new AntdUI.Label();
tabPage3 = new AntdUI.TabPage();
tabPage4 = new AntdUI.TabPage();
switch8 = new AntdUI.Switch();
btnSizeDel = new AntdUI.Button();
btnSizeAdd = new AntdUI.Button();
SizeTable = new AntdUI.Table();
label17 = new AntdUI.Label();
label18 = new AntdUI.Label();
tabs1.SuspendLayout();
tabPage1.SuspendLayout();
tabPage2.SuspendLayout();
tabPage3.SuspendLayout();
tabPage4.SuspendLayout();
SuspendLayout();
//
// tabs1
@ -89,10 +98,10 @@
tabs1.Pages.Add(tabPage1);
tabs1.Pages.Add(tabPage2);
tabs1.Pages.Add(tabPage3);
tabs1.SelectedIndex = 1;
tabs1.SelectedIndex = 2;
tabs1.Size = new Size(915, 609);
tabs1.Style = styleLine1;
tabs1.TabIndex = 2;
tabs1.TabIndex = 1;
tabs1.Text = "tabs1";
//
// tabPage1
@ -110,9 +119,9 @@
tabPage1.Controls.Add(label2);
tabPage1.Controls.Add(iptPath);
tabPage1.Controls.Add(label1);
tabPage1.Location = new Point(-822, -575);
tabPage1.Location = new Point(-909, -575);
tabPage1.Name = "tabPage1";
tabPage1.Size = new Size(822, 575);
tabPage1.Size = new Size(909, 575);
tabPage1.TabIndex = 0;
tabPage1.Text = "预处理";
//
@ -276,11 +285,12 @@
tabPage2.Controls.Add(label7);
tabPage2.Controls.Add(iptPath2);
tabPage2.Controls.Add(label8);
tabPage2.Location = new Point(3, 31);
tabPage2.Location = new Point(-909, -575);
tabPage2.Name = "tabPage2";
tabPage2.Size = new Size(909, 575);
tabPage2.TabIndex = 1;
tabPage2.Text = "模型检测";
tabPage2.Click += tabPage2_Click;
//
// btnLableDelete
//
@ -538,12 +548,86 @@
//
// tabPage3
//
tabPage3.Location = new Point(0, 0);
tabPage3.Controls.Add(tabPage4);
tabPage3.Location = new Point(3, 31);
tabPage3.Name = "tabPage3";
tabPage3.Size = new Size(0, 0);
tabPage3.TabIndex = 2;
tabPage3.Size = new Size(909, 575);
tabPage3.TabIndex = 3;
tabPage3.Text = "尺寸测量";
//
// tabPage4
//
tabPage4.Controls.Add(switch8);
tabPage4.Controls.Add(btnSizeDel);
tabPage4.Controls.Add(btnSizeAdd);
tabPage4.Controls.Add(SizeTable);
tabPage4.Controls.Add(label17);
tabPage4.Controls.Add(label18);
tabPage4.Location = new Point(8, 8);
tabPage4.Name = "tabPage4";
tabPage4.Size = new Size(909, 575);
tabPage4.TabIndex = 1;
tabPage4.Text = "预处理";
//
// switch8
//
switch8.CheckedText = "启用";
switch8.Location = new Point(120, 33);
switch8.Name = "switch8";
switch8.Size = new Size(82, 33);
switch8.TabIndex = 11;
switch8.UnCheckedText = "关闭";
//
// btnSizeDel
//
btnSizeDel.BorderWidth = 2F;
btnSizeDel.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnSizeDel.Ghost = true;
btnSizeDel.IconRatio = 0.8F;
btnSizeDel.IconSvg = resources.GetString("btnSizeDel.IconSvg");
btnSizeDel.Location = new Point(747, 192);
btnSizeDel.Name = "btnSizeDel";
btnSizeDel.Size = new Size(80, 38);
btnSizeDel.TabIndex = 10;
btnSizeDel.Text = "删除";
//
// btnSizeAdd
//
btnSizeAdd.BorderWidth = 2F;
btnSizeAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnSizeAdd.Ghost = true;
btnSizeAdd.IconRatio = 0.8F;
btnSizeAdd.IconSvg = resources.GetString("btnSizeAdd.IconSvg");
btnSizeAdd.Location = new Point(747, 148);
btnSizeAdd.Name = "btnSizeAdd";
btnSizeAdd.Size = new Size(80, 38);
btnSizeAdd.TabIndex = 9;
btnSizeAdd.Text = "新增";
//
// SizeTable
//
SizeTable.Location = new Point(38, 118);
SizeTable.Name = "SizeTable";
SizeTable.Size = new Size(686, 402);
SizeTable.TabIndex = 8;
SizeTable.Text = "table1";
//
// label17
//
label17.Location = new Point(38, 89);
label17.Name = "label17";
label17.Size = new Size(91, 23);
label17.TabIndex = 1;
label17.Text = "配 置";
//
// label18
//
label18.Location = new Point(38, 43);
label18.Name = "label18";
label18.Size = new Size(91, 23);
label18.TabIndex = 3;
label18.Text = "状 态";
//
// DetectControl
//
AutoScaleDimensions = new SizeF(7F, 17F);
@ -554,6 +638,8 @@
tabs1.ResumeLayout(false);
tabPage1.ResumeLayout(false);
tabPage2.ResumeLayout(false);
tabPage3.ResumeLayout(false);
tabPage4.ResumeLayout(false);
ResumeLayout(false);
}
@ -603,5 +689,12 @@
private AntdUI.Table lableTable;
private AntdUI.Button btnLableAdd;
private AntdUI.Button btnLableDelete;
private AntdUI.TabPage tabPage4;
private AntdUI.Button btnSizeDel;
private AntdUI.Button btnSizeAdd;
private AntdUI.Table SizeTable;
private AntdUI.Label label17;
private AntdUI.Label label18;
private AntdUI.Switch switch8;
}
}

View File

@ -12,6 +12,9 @@ using System.Xml.Linq;
using AntdUI;
using DH.Commons.Enums;
using DH.Devices.Vision;
using XKRS.CanFly;
using static AntdUI.Table;
using static DH.Commons.Enums.EnumHelper;
namespace DHSoftware.Views
{
@ -20,7 +23,7 @@ namespace DHSoftware.Views
Window window;
public DetectControl(Window _window)
{
window= _window;
window = _window;
InitializeComponent();
//初始化表格列头
InitTableColumns();
@ -48,6 +51,10 @@ namespace DHSoftware.Views
btnLableDelete.Click += BtnLableDelete_Click;
lableTable.CellButtonClick += LableTable_CellButtonClick;
btnSizeAdd.Click += BtnSizeAdd_Click;
btnSizeDel.Click += BtnSizeDelete_Click;
SizeTable.CellButtonClick += SizeTable_CellButtonClick;
}
private void LableTable_CellButtonClick(object sender, TableButtonEventArgs e)
@ -84,6 +91,75 @@ namespace DHSoftware.Views
}
}
private void SizeTable_CellButtonClick(object sender, TableButtonEventArgs e)
{
var buttontext = e.Btn.Text;
if (e.Record is SizeTreatParam sizeTreat)
{
SizeParamLable = sizeTreat;
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new SizeLabelEdit(window, SizeParamLable) { 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)
SizeLableList.Remove(sizeTreat);
break;
case "进行测量":
var sizeType = ((int)SizeParamLable.PreType).ToString();
// 根据测量类型打开不同的窗口
switch (sizeType)
{
case "1":
case "2":
case "3":
case "4":
case "5":
FrmMain3 frmMain3 = new FrmMain3(sizeType);
frmMain3.ShowDialog();
if (!string.IsNullOrEmpty(frmMain3.inputtext))
{
sizeTreat.ResultShow = frmMain3.inputtext;
}
if (!string.IsNullOrEmpty(frmMain3.outtext))
{
sizeTreat.OutResultShow = frmMain3.outtext;
}
break;
default:
MessageBox.Show("未定义的测量类型!");
break;
}
//使用clone可以防止table中的image被修改
//Preview.open(new Preview.Config(window, (Image)SizeParamLable.CellImages[0].Image.Clone()));
break;
}
}
}
private void BtnLableDelete_Click(object? sender, EventArgs e)
{
if (DetectionLableList.Count == 0 || !DetectionLableList.Any(x => x.Selected))
@ -111,7 +187,7 @@ namespace DHSoftware.Views
private void BtnLableAdd_Click(object? sender, EventArgs e)
{
DetectionLable detectionLable = new DetectionLable()
DetectionLable detectionLable = new DetectionLable()
{
CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
@ -129,15 +205,65 @@ namespace DHSoftware.Views
}
}
private void BtnSizeDelete_Click(object? sender, EventArgs e)
{
if (SizeLableList.Count == 0 || !SizeLableList.Any(x => x.Selected))
{
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
}
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
// 使用反转for循环删除主列表中选中的项
for (int i = SizeLableList.Count - 1; i >= 0; i--)
{
// 删除选中的主列表项
if (SizeLableList[i].Selected)
{
SizeLableList.RemoveAt(i);
}
}
// 提示删除完成
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
}
}
private void BtnSizeAdd_Click(object? sender, EventArgs e)
{
SizeTreatParam SizeParamLable = new SizeTreatParam()
{
//CellBadge = new CellBadge(SizeEnum.Circle.GetEnumDescription()),
CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
new CellButton(Guid.NewGuid().ToString(),"进行测量",TTypeMini.Primary)
}
};
var form = new SizeLabelEdit(window, SizeParamLable) { Size = new Size(450, 500) };
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
{
BtnHeight = 0,
});
if (form.submit)
{
SizeLableList.Add(SizeParamLable);
}
}
private void BtnPic_Click(object? sender, EventArgs e)
{
}
List<RelatedCamera> relatedCameras = new List<RelatedCamera>();
private void BtnCorrelatedCamera_Click(object? sender, EventArgs e)
{
var form = new CorrelatedCameraEdit(window, relatedCameras) { Size = new Size(500, 400) };
@ -179,8 +305,8 @@ namespace DHSoftware.Views
control.BringToFront();
}
}
}
}
}
}
private bool Control_CloseChanged(object sender, EventArgs e)
{
@ -272,6 +398,7 @@ namespace DHSoftware.Views
{
PreTreatParam preParam = new PreTreatParam()
{
CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
@ -317,7 +444,7 @@ namespace DHSoftware.Views
if (result == DialogResult.OK)
PreTreatList.Remove(PreTreat);
break;
}
}
}
@ -325,15 +452,15 @@ namespace DHSoftware.Views
private void PreTable_CellClick(object sender, TableClickEventArgs e)
{
}
private void BtnPreDelete_Click(object? sender, EventArgs e)
{
if (PreTreatList.Count == 0 || !PreTreatList.Any(x => x.Selected))
{
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
}
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
@ -376,9 +503,11 @@ namespace DHSoftware.Views
AntList<PreTreatParam> PreTreatList;
AntList<PreTreatParam> PreOutTreatList;
AntList<DetectionLable> DetectionLableList;
AntList<SizeTreatParam> SizeLableList;
PreTreatParam curPreTreat;
PreTreatParam curPreOutTreat;
DetectionLable curDetectionLable;
SizeTreatParam SizeParamLable;
private void InitData()
{
PreTreatList = new AntList<PreTreatParam>();
@ -389,17 +518,20 @@ namespace DHSoftware.Views
PreOutTable.Binding(PreOutTreatList);
foreach (var item in MLModelTypes)
{
stDetectType.Items.Add(item.Key);
}
DetectionLableList =new AntList<DetectionLable>();
DetectionLableList = new AntList<DetectionLable>();
lableTable.Binding(DetectionLableList);
SizeLableList = new AntList<SizeTreatParam>();
SizeTable.Binding(SizeLableList);
}
private void InitTableColumns()
@ -429,6 +561,17 @@ namespace DHSoftware.Views
new Column("ResultState", "结果", ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
};
SizeTable.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new ColumnSwitch("IsEnable", "是否启用", ColumnAlign.Center),
new Column("PreName", "测量名称",ColumnAlign.Center),
new Column("PreType", "测量类型", ColumnAlign.Center),
new Column("PrePix", "阈值", ColumnAlign.Center),
new Column("ResultShow", "输入参数", ColumnAlign.Center),
new Column("OutResultShow", "输出参数", ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
};
}
private void btnPath_Click(object? sender, EventArgs e)
@ -446,18 +589,24 @@ namespace DHSoftware.Views
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
string filePath = openFileDialog.FileName;
iptPath.Text = filePath;
}
}
}
List<KeyValuePair<string, int>> MLModelTypes = GetFilteredEnumDescriptionsAndValues<MLModelType>();
List<KeyValuePair<string, int>> SizeEnum = GetFilteredEnumDescriptionsAndValues<SizeEnum>();
private void tabPage2_Click(object sender, EventArgs e)
{
}
public static List<KeyValuePair<string, int>> GetFilteredEnumDescriptionsAndValues<T>() where T : Enum
{

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
@ -147,4 +147,10 @@
<data name="btnPath2.IconSvg" xml:space="preserve">
<value>&lt;svg t="1741939836774" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21349" width="200" height="200"&gt;&lt;path d="M1003.153333 404.96a52.933333 52.933333 0 0 0-42.38-20.96H896V266.666667a53.393333 53.393333 0 0 0-53.333333-53.333334H461.253333a10.573333 10.573333 0 0 1-7.54-3.126666L344.46 100.953333A52.986667 52.986667 0 0 0 306.746667 85.333333H53.333333a53.393333 53.393333 0 0 0-53.333333 53.333334v704a53.393333 53.393333 0 0 0 53.333333 53.333333h796.893334a53.453333 53.453333 0 0 0 51.453333-39.333333l110.546667-405.333334a52.953333 52.953333 0 0 0-9.073334-46.373333zM53.333333 128h253.413334a10.573333 10.573333 0 0 1 7.54 3.126667l109.253333 109.253333A52.986667 52.986667 0 0 0 461.253333 256H842.666667a10.666667 10.666667 0 0 1 10.666666 10.666667v117.333333H173.773333a53.453333 53.453333 0 0 0-51.453333 39.333333L42.666667 715.366667V138.666667a10.666667 10.666667 0 0 1 10.666666-10.666667zm917.726667 312.14l-110.546667 405.333333a10.666667 10.666667 0 0 1-10.286666 7.86H63.226667a10.666667 10.666667 0 0 1-10.286667-13.473333l110.546667-405.333333A10.666667 10.666667 0 0 1 173.773333 426.666667h787a10.666667 10.666667 0 0 1 10.286667 13.473333z" fill="#5C5C66" p-id="21350"/&gt;&lt;/svg&gt;</value>
</data>
<data name="btnSizeDel.IconSvg" xml:space="preserve">
<value>&lt;svg t="1741939836774" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21349" width="200" height="200"&gt;&lt;path d="M1003.153333 404.96a52.933333 52.933333 0 0 0-42.38-20.96H896V266.666667a53.393333 53.393333 0 0 0-53.333333-53.333334H461.253333a10.573333 10.573333 0 0 1-7.54-3.126666L344.46 100.953333A52.986667 52.986667 0 0 0 306.746667 85.333333H53.333333a53.393333 53.393333 0 0 0-53.333333 53.333334v704a53.393333 53.393333 0 0 0 53.333333 53.333333h796.893334a53.453333 53.453333 0 0 0 51.453333-39.333333l110.546667-405.333334a52.953333 52.953333 0 0 0-9.073334-46.373333zM53.333333 128h253.413334a10.573333 10.573333 0 0 1 7.54 3.126667l109.253333 109.253333A52.986667 52.986667 0 0 0 461.253333 256H842.666667a10.666667 10.666667 0 0 1 10.666666 10.666667v117.333333H173.773333a53.453333 53.453333 0 0 0-51.453333 39.333333L42.666667 715.366667V138.666667a10.666667 10.666667 0 0 1 10.666666-10.666667zm917.726667 312.14l-110.546667 405.333333a10.666667 10.666667 0 0 1-10.286666 7.86H63.226667a10.666667 10.666667 0 0 1-10.286667-13.473333l110.546667-405.333333A10.666667 10.666667 0 0 1 173.773333 426.666667h787a10.666667 10.666667 0 0 1 10.286667 13.473333z" fill="#5C5C66" p-id="21350"/&gt;&lt;/svg&gt;</value>
</data>
<data name="btnSizeAdd.IconSvg" xml:space="preserve">
<value>&lt;svg t="1741939836774" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21349" width="200" height="200"&gt;&lt;path d="M1003.153333 404.96a52.933333 52.933333 0 0 0-42.38-20.96H896V266.666667a53.393333 53.393333 0 0 0-53.333333-53.333334H461.253333a10.573333 10.573333 0 0 1-7.54-3.126666L344.46 100.953333A52.986667 52.986667 0 0 0 306.746667 85.333333H53.333333a53.393333 53.393333 0 0 0-53.333333 53.333334v704a53.393333 53.393333 0 0 0 53.333333 53.333333h796.893334a53.453333 53.453333 0 0 0 51.453333-39.333333l110.546667-405.333334a52.953333 52.953333 0 0 0-9.073334-46.373333zM53.333333 128h253.413334a10.573333 10.573333 0 0 1 7.54 3.126667l109.253333 109.253333A52.986667 52.986667 0 0 0 461.253333 256H842.666667a10.666667 10.666667 0 0 1 10.666666 10.666667v117.333333H173.773333a53.453333 53.453333 0 0 0-51.453333 39.333333L42.666667 715.366667V138.666667a10.666667 10.666667 0 0 1 10.666666-10.666667zm917.726667 312.14l-110.546667 405.333333a10.666667 10.666667 0 0 1-10.286666 7.86H63.226667a10.666667 10.666667 0 0 1-10.286667-13.473333l110.546667-405.333333A10.666667 10.666667 0 0 1 173.773333 426.666667h787a10.666667 10.666667 0 0 1 10.286667 13.473333z" fill="#5C5C66" p-id="21350"/&gt;&lt;/svg&gt;</value>
</data>
</root>

View File

@ -81,6 +81,7 @@
// sltResultState
//
sltResultState.Dock = DockStyle.Top;
sltResultState.List = true;
sltResultState.Location = new Point(18, 444);
sltResultState.Name = "sltResultState";
sltResultState.Size = new Size(464, 45);

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

263
DHSoftware/Views/SizeLabelEdit.Designer.cs generated Normal file
View File

@ -0,0 +1,263 @@
namespace DHSoftware.Views
{
partial class SizeLabelEdit
{
/// <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()
{
button_cancel = new AntdUI.Button();
iptName = new AntdUI.Input();
label2 = new AntdUI.Label();
divider2 = new AntdUI.Divider();
stackPanel1 = new AntdUI.StackPanel();
button_ok = new AntdUI.Button();
divider1 = new AntdUI.Divider();
label1 = new AntdUI.Label();
panel1 = new AntdUI.Panel();
iptOutParam = new AntdUI.Input();
label6 = new AntdUI.Label();
iptIntParam = new AntdUI.Input();
label5 = new AntdUI.Label();
ipthreshold = new AntdUI.InputNumber();
label4 = new AntdUI.Label();
sltSizeEnum = new AntdUI.Select();
label3 = new AntdUI.Label();
stackPanel1.SuspendLayout();
panel1.SuspendLayout();
SuspendLayout();
//
// button_cancel
//
button_cancel.BorderWidth = 1F;
button_cancel.Font = new Font("Microsoft YaHei UI", 9F);
button_cancel.Ghost = true;
button_cancel.Location = new Point(84, 3);
button_cancel.Name = "button_cancel";
button_cancel.Size = new Size(75, 38);
button_cancel.TabIndex = 1;
button_cancel.Text = "取消";
//
// iptName
//
iptName.Dock = DockStyle.Top;
iptName.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
iptName.Location = new Point(18, 134);
iptName.Name = "iptName";
iptName.Radius = 3;
iptName.Size = new Size(409, 38);
iptName.TabIndex = 23;
//
// label2
//
label2.Dock = DockStyle.Top;
label2.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label2.Location = new Point(18, 110);
label2.Name = "label2";
label2.Size = new Size(409, 24);
label2.TabIndex = 22;
label2.Text = "测量名称";
//
// divider2
//
divider2.Dock = DockStyle.Top;
divider2.Location = new Point(18, 98);
divider2.Name = "divider2";
divider2.Size = new Size(409, 12);
divider2.TabIndex = 21;
//
// stackPanel1
//
stackPanel1.Controls.Add(button_cancel);
stackPanel1.Controls.Add(button_ok);
stackPanel1.Dock = DockStyle.Top;
stackPanel1.Location = new Point(18, 54);
stackPanel1.Name = "stackPanel1";
stackPanel1.RightToLeft = RightToLeft.No;
stackPanel1.Size = new Size(409, 44);
stackPanel1.TabIndex = 20;
stackPanel1.Text = "stackPanel1";
//
// button_ok
//
button_ok.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
button_ok.Location = new Point(3, 3);
button_ok.Name = "button_ok";
button_ok.Size = new Size(75, 38);
button_ok.TabIndex = 0;
button_ok.Text = "确定";
button_ok.Type = AntdUI.TTypeMini.Primary;
//
// divider1
//
divider1.Dock = DockStyle.Top;
divider1.Location = new Point(18, 42);
divider1.Name = "divider1";
divider1.Size = new Size(409, 12);
divider1.TabIndex = 19;
//
// label1
//
label1.Dock = DockStyle.Top;
label1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label1.Location = new Point(18, 18);
label1.Name = "label1";
label1.Size = new Size(409, 24);
label1.TabIndex = 17;
label1.Text = "尺寸测量操作";
//
// panel1
//
panel1.Controls.Add(iptOutParam);
panel1.Controls.Add(label6);
panel1.Controls.Add(iptIntParam);
panel1.Controls.Add(label5);
panel1.Controls.Add(ipthreshold);
panel1.Controls.Add(label4);
panel1.Controls.Add(sltSizeEnum);
panel1.Controls.Add(label3);
panel1.Controls.Add(iptName);
panel1.Controls.Add(label2);
panel1.Controls.Add(divider2);
panel1.Controls.Add(stackPanel1);
panel1.Controls.Add(divider1);
panel1.Controls.Add(label1);
panel1.Dock = DockStyle.Fill;
panel1.Location = new Point(0, 0);
panel1.Name = "panel1";
panel1.Padding = new Padding(12);
panel1.Shadow = 6;
panel1.Size = new Size(445, 459);
panel1.TabIndex = 1;
panel1.Text = "panel1";
//
// iptOutParam
//
iptOutParam.Dock = DockStyle.Top;
iptOutParam.Location = new Point(18, 381);
iptOutParam.Name = "iptOutParam";
iptOutParam.ReadOnly = true;
iptOutParam.Size = new Size(409, 37);
iptOutParam.TabIndex = 43;
//
// label6
//
label6.Dock = DockStyle.Top;
label6.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label6.Location = new Point(18, 357);
label6.Name = "label6";
label6.Size = new Size(409, 24);
label6.TabIndex = 42;
label6.Text = "输入参数";
//
// iptIntParam
//
iptIntParam.Dock = DockStyle.Top;
iptIntParam.Location = new Point(18, 320);
iptIntParam.Name = "iptIntParam";
iptIntParam.ReadOnly = true;
iptIntParam.Size = new Size(409, 37);
iptIntParam.TabIndex = 41;
//
// label5
//
label5.Dock = DockStyle.Top;
label5.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label5.Location = new Point(18, 296);
label5.Name = "label5";
label5.Size = new Size(409, 24);
label5.TabIndex = 37;
label5.Text = "输入参数";
//
// ipthreshold
//
ipthreshold.Dock = DockStyle.Top;
ipthreshold.Location = new Point(18, 258);
ipthreshold.Name = "ipthreshold";
ipthreshold.Size = new Size(409, 38);
ipthreshold.TabIndex = 36;
ipthreshold.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, 234);
label4.Name = "label4";
label4.Size = new Size(409, 24);
label4.TabIndex = 35;
label4.Text = "阈值";
//
// sltSizeEnum
//
sltSizeEnum.Dock = DockStyle.Top;
sltSizeEnum.List = true;
sltSizeEnum.Location = new Point(18, 196);
sltSizeEnum.Name = "sltSizeEnum";
sltSizeEnum.Size = new Size(409, 38);
sltSizeEnum.TabIndex = 34;
//
// label3
//
label3.Dock = DockStyle.Top;
label3.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label3.Location = new Point(18, 172);
label3.Name = "label3";
label3.Size = new Size(409, 24);
label3.TabIndex = 24;
label3.Text = "测量类型";
//
// SizeLabelEdit
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(panel1);
Name = "SizeLabelEdit";
Size = new Size(445, 459);
stackPanel1.ResumeLayout(false);
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private AntdUI.Button button_cancel;
private AntdUI.Input iptName;
private AntdUI.Label label2;
private AntdUI.Divider divider2;
private AntdUI.StackPanel stackPanel1;
private AntdUI.Button button_ok;
private AntdUI.Divider divider1;
private AntdUI.Label label1;
private AntdUI.Panel panel1;
private AntdUI.Label label3;
private AntdUI.Select sltSizeEnum;
private AntdUI.InputNumber ipthreshold;
private AntdUI.Label label4;
private AntdUI.Label label5;
private AntdUI.Input iptOutParam;
private AntdUI.Label label6;
private AntdUI.Input iptIntParam;
}
}

View File

@ -0,0 +1,94 @@
using DH.Commons.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static DH.Commons.Enums.EnumHelper;
namespace DHSoftware.Views
{
public partial class SizeLabelEdit : UserControl
{
private AntdUI.Window window;
private SizeTreatParam sizeLabel;
public bool submit;
public SizeLabelEdit(AntdUI.Window _window, SizeTreatParam SizeLabel)
{
InitializeComponent();
sizeLabel = SizeLabel;
//设置默认值
InitData();
// 绑定事件
BindEventHandler();
}
private void BindEventHandler()
{
button_ok.Click += Button_ok_Click;
button_cancel.Click += Button_cancel_Click;
}
private void Button_cancel_Click(object sender, EventArgs e)
{
submit = false;
this.Dispose();
}
private void Button_ok_Click(object sender, EventArgs e)
{
iptName.Status = AntdUI.TType.None;
//检查输入内容
if (String.IsNullOrEmpty(iptName.Text))
{
iptName.Status = AntdUI.TType.Error;
AntdUI.Message.warn(window, "参数名称不能为空!", autoClose: 3);
return;
}
sizeLabel.PreName = iptName.Text;
sizeLabel.PrePix = Convert.ToInt32(ipthreshold.Text);
sizeLabel.ResultShow = iptIntParam.Text;
sizeLabel.OutResultShow =iptOutParam.Text;
SizeEnum state = EnumHelper.GetEnumFromDescription<SizeEnum>(sltSizeEnum.Text);
sizeLabel.PreType = state;
submit = true;
this.Dispose();
}
private void InitData()
{
// 清空原有项
sltSizeEnum.Items.Clear();
foreach (SizeEnum state in Enum.GetValues(typeof(SizeEnum)))
{
string description = EnumHelper.GetEnumDescription(state);
sltSizeEnum.Items.Add(description);
}
if (string.IsNullOrEmpty(sizeLabel.PreName))
{
iptName.Text = string.Empty;
ipthreshold.Text = "1";
iptIntParam.Text = string.Empty;
iptOutParam.Text = string.Empty;
sltSizeEnum.SelectedIndex = 0;
}
else
{
iptName.Text = sizeLabel.PreName;
ipthreshold.Text = sizeLabel.PrePix.ToString();
iptIntParam.Text = sizeLabel.ResultShow;
iptOutParam.Text = sizeLabel.OutResultShow;
sltSizeEnum.Text = EnumHelper.GetEnumDescription(sizeLabel.PreType);
}
}
}
}

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>