Compare commits
2 Commits
ec642b707e
...
43e7f3009d
Author | SHA1 | Date | |
---|---|---|---|
43e7f3009d | |||
ae11376f5a |
@@ -142,4 +142,7 @@
|
|||||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>25</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
160
CanFly/UI/SizePanel/SizeBaseGuideControl.cs
Normal file
160
CanFly/UI/SizePanel/SizeBaseGuideControl.cs
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
using CanFly.Canvas.Shape;
|
||||||
|
using CanFly.Canvas.UI;
|
||||||
|
using CanFly.Helper;
|
||||||
|
using DH.Commons.Base;
|
||||||
|
using HalconDotNet;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace CanFly.UI.SizePanel
|
||||||
|
{
|
||||||
|
|
||||||
|
public class SizeBaseGuideControl : UserControl
|
||||||
|
{
|
||||||
|
public Action? OnControlCloseEvent;
|
||||||
|
|
||||||
|
public event Action<string,string> OnDataPassed;
|
||||||
|
|
||||||
|
|
||||||
|
private string _currentImageFile;
|
||||||
|
|
||||||
|
public string CurrentImageFile;
|
||||||
|
|
||||||
|
public CameraBase cameraBase;
|
||||||
|
|
||||||
|
protected string _hScriptsDir = Path.Combine(Environment.CurrentDirectory, "hscripts");
|
||||||
|
|
||||||
|
protected HObject? hImage = null;
|
||||||
|
|
||||||
|
protected FlyCanvas _canvas;
|
||||||
|
|
||||||
|
private HDevEngineTool? tool = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void DataToTriggerEvent(string input,string output)
|
||||||
|
{
|
||||||
|
|
||||||
|
OnDataPassed?.Invoke(input, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void UpdateShape(FlyShape shape)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual string GetScriptFileName()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行Halcon脚本
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inputImg">输入图像</param>
|
||||||
|
/// <param name="inputDic">输入参数</param>
|
||||||
|
/// <param name="outputParamKeys">输出参数</param>
|
||||||
|
protected void ExecuteHScript(
|
||||||
|
Dictionary<string, HObject> inputImg,
|
||||||
|
Dictionary<string, HTuple> inputDic,
|
||||||
|
List<string> outputParamKeys,
|
||||||
|
Action<Exception>? exceptionHandler = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
string filePath = Path.Combine(_hScriptsDir, GetScriptFileName());
|
||||||
|
if (!File.Exists(filePath))
|
||||||
|
{
|
||||||
|
MessageBox.Show($"文件 {filePath} 不存在");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (tool == null)
|
||||||
|
{
|
||||||
|
tool = new HDevEngineTool(_hScriptsDir);
|
||||||
|
tool.LoadProcedure(Path.GetFileNameWithoutExtension(GetScriptFileName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tool.InputImageDic["INPUT_Image"] = hImage;
|
||||||
|
//tool.InputTupleDic["XCenter"] = _x;
|
||||||
|
//tool.InputTupleDic["YCenter"] = _y;
|
||||||
|
//tool.InputTupleDic["Radius"] = _r;
|
||||||
|
|
||||||
|
tool.InputImageDic = inputImg;
|
||||||
|
tool.InputTupleDic = inputDic;
|
||||||
|
|
||||||
|
|
||||||
|
Dictionary<string, HTuple> outputParams = new Dictionary<string, HTuple>();
|
||||||
|
|
||||||
|
|
||||||
|
if (!tool.RunProcedure(out string error, out int timeElasped))
|
||||||
|
{
|
||||||
|
OnExecuteHScriptResult(false, outputParams, timeElasped);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < outputParamKeys.Count; i++)
|
||||||
|
{
|
||||||
|
string k = outputParamKeys[i];
|
||||||
|
outputParams[k] = tool.GetResultTuple(k);
|
||||||
|
}
|
||||||
|
|
||||||
|
OnExecuteHScriptResult(true, outputParams, timeElasped);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
exceptionHandler?.Invoke(ex);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
hImage?.Dispose();
|
||||||
|
hImage = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Halcon脚本执行结果回调函数,重写该方法以自行处理算法执行结果
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="success">算法执行是否成功</param>
|
||||||
|
/// <param name="resultDic">算法输出结果</param>
|
||||||
|
/// <param name="timeElasped">算法耗时,单位:ms</param>
|
||||||
|
protected virtual void OnExecuteHScriptResult(bool success, Dictionary<string, HTuple> resultDic, int timeElasped)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void OpenImageFile(Action<Bitmap> callback)
|
||||||
|
{
|
||||||
|
OpenFileDialog ofd = new OpenFileDialog();
|
||||||
|
ofd.Filter = "图像文件|*.jpg;*.jpeg;*.png";
|
||||||
|
ofd.Multiselect = false;
|
||||||
|
if (ofd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
CurrentImageFile = ofd.FileName;
|
||||||
|
Bitmap bitmap = (Bitmap)Image.FromFile(CurrentImageFile);
|
||||||
|
callback?.Invoke(bitmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void OnControlClose()
|
||||||
|
{
|
||||||
|
OnControlCloseEvent?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</resheader>
|
<resheader name="version">2.0</resheader>
|
||||||
@@ -26,36 +26,36 @@
|
|||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
value : The object must be serialized into a byte array
|
value : The object must be serialized into a byte array
|
||||||
: using a System.ComponentModel.TypeConverter
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
77
CanFly/UI/SizePanel/SizeCtrlTitleBar.Designer.cs
generated
Normal file
77
CanFly/UI/SizePanel/SizeCtrlTitleBar.Designer.cs
generated
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
namespace CanFly.UI.SizePanel
|
||||||
|
{
|
||||||
|
partial class SizeCtrlTitleBar
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
btnClose = new PictureBox();
|
||||||
|
j = new Label();
|
||||||
|
((System.ComponentModel.ISupportInitialize)btnClose).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// btnClose
|
||||||
|
//
|
||||||
|
btnClose.Dock = DockStyle.Right;
|
||||||
|
btnClose.Image = XKRS.CanFly.Properties.Resources.Close;
|
||||||
|
btnClose.Location = new Point(516, 3);
|
||||||
|
btnClose.Name = "btnClose";
|
||||||
|
btnClose.Size = new Size(30, 30);
|
||||||
|
btnClose.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||||
|
btnClose.TabIndex = 1;
|
||||||
|
btnClose.TabStop = false;
|
||||||
|
btnClose.Click += btnClose_Click;
|
||||||
|
//
|
||||||
|
// j
|
||||||
|
//
|
||||||
|
j.Dock = DockStyle.Fill;
|
||||||
|
j.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Bold);
|
||||||
|
j.Location = new Point(3, 3);
|
||||||
|
j.Name = "j";
|
||||||
|
j.Size = new Size(513, 30);
|
||||||
|
j.TabIndex = 2;
|
||||||
|
j.Text = "标题";
|
||||||
|
j.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
|
//
|
||||||
|
// SizeCtrlTitleBar
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(j);
|
||||||
|
Controls.Add(btnClose);
|
||||||
|
MinimumSize = new Size(0, 36);
|
||||||
|
Name = "SizeCtrlTitleBar";
|
||||||
|
Padding = new Padding(3);
|
||||||
|
Size = new Size(549, 36);
|
||||||
|
((System.ComponentModel.ISupportInitialize)btnClose).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
private PictureBox btnClose;
|
||||||
|
private Label j;
|
||||||
|
}
|
||||||
|
}
|
38
CanFly/UI/SizePanel/SizeCtrlTitleBar.cs
Normal file
38
CanFly/UI/SizePanel/SizeCtrlTitleBar.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
namespace CanFly.UI.SizePanel
|
||||||
|
{
|
||||||
|
public partial class SizeCtrlTitleBar : UserControl
|
||||||
|
{
|
||||||
|
public event Action? OnCloseClicked;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[DisplayName("Title")]
|
||||||
|
public string Title
|
||||||
|
{
|
||||||
|
get { return this.j.Text; }
|
||||||
|
set { this.j.Text = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public SizeCtrlTitleBar()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.Dock = DockStyle.Top;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnClose_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OnCloseClicked?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
364
CanFly/UI/SizePanel/SizeGuideCircleCtrl.Designer.cs
generated
Normal file
364
CanFly/UI/SizePanel/SizeGuideCircleCtrl.Designer.cs
generated
Normal file
@@ -0,0 +1,364 @@
|
|||||||
|
namespace CanFly.UI.SizePanel
|
||||||
|
{
|
||||||
|
partial class SizeGuideCircleCtrl
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SizeGuideCircleCtrl));
|
||||||
|
splitContainer = new SplitContainer();
|
||||||
|
panel1 = new Panel();
|
||||||
|
canvas = new Canvas.UI.FlyCanvas();
|
||||||
|
statusStrip1 = new StatusStrip();
|
||||||
|
lblStatus = new ToolStripStatusLabel();
|
||||||
|
btnClose = new PictureBox();
|
||||||
|
label4 = new Label();
|
||||||
|
btnExecute = new Button();
|
||||||
|
lblElapsed = new Label();
|
||||||
|
ctrlTitleBar = new SizeCtrlTitleBar();
|
||||||
|
groupBox1 = new GroupBox();
|
||||||
|
label1 = new Label();
|
||||||
|
label2 = new Label();
|
||||||
|
label3 = new Label();
|
||||||
|
tbR = new TextBox();
|
||||||
|
tbY = new TextBox();
|
||||||
|
tbX = new TextBox();
|
||||||
|
btnLoadImage = new Button();
|
||||||
|
btnCreateCircle = new Button();
|
||||||
|
btnSave = new Button();
|
||||||
|
label6 = new Label();
|
||||||
|
lblResult = new Label();
|
||||||
|
panelGuide = new Panel();
|
||||||
|
((System.ComponentModel.ISupportInitialize)splitContainer).BeginInit();
|
||||||
|
splitContainer.Panel1.SuspendLayout();
|
||||||
|
splitContainer.Panel2.SuspendLayout();
|
||||||
|
splitContainer.SuspendLayout();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
statusStrip1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)btnClose).BeginInit();
|
||||||
|
groupBox1.SuspendLayout();
|
||||||
|
panelGuide.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// splitContainer
|
||||||
|
//
|
||||||
|
splitContainer.Dock = DockStyle.Fill;
|
||||||
|
splitContainer.Location = new Point(0, 0);
|
||||||
|
splitContainer.Name = "splitContainer";
|
||||||
|
//
|
||||||
|
// splitContainer.Panel1
|
||||||
|
//
|
||||||
|
splitContainer.Panel1.Controls.Add(panelGuide);
|
||||||
|
splitContainer.Panel1MinSize = 150;
|
||||||
|
//
|
||||||
|
// splitContainer.Panel2
|
||||||
|
//
|
||||||
|
splitContainer.Panel2.Controls.Add(panel1);
|
||||||
|
splitContainer.Size = new Size(1280, 640);
|
||||||
|
splitContainer.SplitterDistance = 200;
|
||||||
|
splitContainer.TabIndex = 12;
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
panel1.Controls.Add(canvas);
|
||||||
|
panel1.Controls.Add(statusStrip1);
|
||||||
|
panel1.Dock = DockStyle.Fill;
|
||||||
|
panel1.Location = new Point(0, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(1076, 640);
|
||||||
|
panel1.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// canvas
|
||||||
|
//
|
||||||
|
canvas.AllowMultiSelect = false;
|
||||||
|
canvas.CreateMode = Canvas.Shape.ShapeTypeEnum.Polygon;
|
||||||
|
canvas.Dock = DockStyle.Fill;
|
||||||
|
canvas.Enabled = false;
|
||||||
|
canvas.FillDrawing = false;
|
||||||
|
canvas.Location = new Point(0, 0);
|
||||||
|
canvas.Margin = new Padding(2);
|
||||||
|
canvas.Name = "canvas";
|
||||||
|
canvas.OutsideShapes = (List<Canvas.Shape.FlyShape>)resources.GetObject("canvas.OutsideShapes");
|
||||||
|
canvas.Scale = 1F;
|
||||||
|
canvas.Shapes = (List<Canvas.Shape.FlyShape>)resources.GetObject("canvas.Shapes");
|
||||||
|
canvas.Size = new Size(1074, 616);
|
||||||
|
canvas.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// statusStrip1
|
||||||
|
//
|
||||||
|
statusStrip1.Items.AddRange(new ToolStripItem[] { lblStatus });
|
||||||
|
statusStrip1.Location = new Point(0, 616);
|
||||||
|
statusStrip1.Name = "statusStrip1";
|
||||||
|
statusStrip1.Size = new Size(1074, 22);
|
||||||
|
statusStrip1.TabIndex = 1;
|
||||||
|
statusStrip1.Text = "statusStrip1";
|
||||||
|
//
|
||||||
|
// lblStatus
|
||||||
|
//
|
||||||
|
lblStatus.Name = "lblStatus";
|
||||||
|
lblStatus.Size = new Size(44, 17);
|
||||||
|
lblStatus.Text = " ";
|
||||||
|
//
|
||||||
|
// btnClose
|
||||||
|
//
|
||||||
|
btnClose.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
btnClose.Image = XKRS.CanFly.Properties.Resources.Close;
|
||||||
|
btnClose.InitialImage = XKRS.CanFly.Properties.Resources.Close;
|
||||||
|
btnClose.Location = new Point(1102, 3);
|
||||||
|
btnClose.Name = "btnClose";
|
||||||
|
btnClose.Size = new Size(33, 33);
|
||||||
|
btnClose.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||||
|
btnClose.TabIndex = 5;
|
||||||
|
btnClose.TabStop = false;
|
||||||
|
btnClose.Click += btnClose_Click;
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.Location = new Point(6, 307);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new Size(44, 17);
|
||||||
|
label4.TabIndex = 3;
|
||||||
|
label4.Text = "耗时:";
|
||||||
|
//
|
||||||
|
// btnExecute
|
||||||
|
//
|
||||||
|
btnExecute.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnExecute.Location = new Point(6, 272);
|
||||||
|
btnExecute.Name = "btnExecute";
|
||||||
|
btnExecute.Size = new Size(186, 32);
|
||||||
|
btnExecute.TabIndex = 2;
|
||||||
|
btnExecute.Text = "执行";
|
||||||
|
btnExecute.UseVisualStyleBackColor = true;
|
||||||
|
btnExecute.Click += btnExecute_Click;
|
||||||
|
//
|
||||||
|
// lblElapsed
|
||||||
|
//
|
||||||
|
lblElapsed.AutoSize = true;
|
||||||
|
lblElapsed.Location = new Point(56, 307);
|
||||||
|
lblElapsed.Name = "lblElapsed";
|
||||||
|
lblElapsed.Size = new Size(32, 17);
|
||||||
|
lblElapsed.TabIndex = 4;
|
||||||
|
lblElapsed.Text = "0ms";
|
||||||
|
//
|
||||||
|
// ctrlTitleBar
|
||||||
|
//
|
||||||
|
ctrlTitleBar.Dock = DockStyle.Top;
|
||||||
|
ctrlTitleBar.Location = new Point(0, 0);
|
||||||
|
ctrlTitleBar.MinimumSize = new Size(0, 36);
|
||||||
|
ctrlTitleBar.Name = "ctrlTitleBar";
|
||||||
|
ctrlTitleBar.Padding = new Padding(3);
|
||||||
|
ctrlTitleBar.Size = new Size(198, 36);
|
||||||
|
ctrlTitleBar.TabIndex = 11;
|
||||||
|
ctrlTitleBar.Title = "圆形测量";
|
||||||
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
groupBox1.Controls.Add(tbX);
|
||||||
|
groupBox1.Controls.Add(tbY);
|
||||||
|
groupBox1.Controls.Add(tbR);
|
||||||
|
groupBox1.Controls.Add(label3);
|
||||||
|
groupBox1.Controls.Add(label2);
|
||||||
|
groupBox1.Controls.Add(label1);
|
||||||
|
groupBox1.Dock = DockStyle.Top;
|
||||||
|
groupBox1.Location = new Point(0, 36);
|
||||||
|
groupBox1.Name = "groupBox1";
|
||||||
|
groupBox1.Size = new Size(198, 116);
|
||||||
|
groupBox1.TabIndex = 12;
|
||||||
|
groupBox1.TabStop = false;
|
||||||
|
groupBox1.Text = "圆参数";
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(6, 25);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(19, 17);
|
||||||
|
label1.TabIndex = 0;
|
||||||
|
label1.Text = "X:";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(6, 54);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(18, 17);
|
||||||
|
label2.TabIndex = 1;
|
||||||
|
label2.Text = "Y:";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Location = new Point(3, 83);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(44, 17);
|
||||||
|
label3.TabIndex = 2;
|
||||||
|
label3.Text = "半径:";
|
||||||
|
//
|
||||||
|
// tbR
|
||||||
|
//
|
||||||
|
tbR.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbR.Location = new Point(56, 80);
|
||||||
|
tbR.Name = "tbR";
|
||||||
|
tbR.Size = new Size(136, 23);
|
||||||
|
tbR.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// tbY
|
||||||
|
//
|
||||||
|
tbY.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbY.Location = new Point(56, 51);
|
||||||
|
tbY.Name = "tbY";
|
||||||
|
tbY.Size = new Size(136, 23);
|
||||||
|
tbY.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// tbX
|
||||||
|
//
|
||||||
|
tbX.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbX.Location = new Point(56, 22);
|
||||||
|
tbX.Name = "tbX";
|
||||||
|
tbX.Size = new Size(136, 23);
|
||||||
|
tbX.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// btnLoadImage
|
||||||
|
//
|
||||||
|
btnLoadImage.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnLoadImage.Location = new Point(6, 158);
|
||||||
|
btnLoadImage.Name = "btnLoadImage";
|
||||||
|
btnLoadImage.Size = new Size(186, 32);
|
||||||
|
btnLoadImage.TabIndex = 13;
|
||||||
|
btnLoadImage.Text = "打开图片";
|
||||||
|
btnLoadImage.UseVisualStyleBackColor = true;
|
||||||
|
btnLoadImage.Click += btnLoadImage_Click;
|
||||||
|
//
|
||||||
|
// btnCreateCircle
|
||||||
|
//
|
||||||
|
btnCreateCircle.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnCreateCircle.Location = new Point(6, 196);
|
||||||
|
btnCreateCircle.Name = "btnCreateCircle";
|
||||||
|
btnCreateCircle.Size = new Size(186, 32);
|
||||||
|
btnCreateCircle.TabIndex = 14;
|
||||||
|
btnCreateCircle.Text = "创建圆形";
|
||||||
|
btnCreateCircle.UseVisualStyleBackColor = true;
|
||||||
|
btnCreateCircle.Click += btnCreateCircle_Click;
|
||||||
|
//
|
||||||
|
// btnSave
|
||||||
|
//
|
||||||
|
btnSave.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnSave.Location = new Point(9, 397);
|
||||||
|
btnSave.Name = "btnSave";
|
||||||
|
btnSave.Size = new Size(186, 32);
|
||||||
|
btnSave.TabIndex = 15;
|
||||||
|
btnSave.Text = "保存数据";
|
||||||
|
btnSave.UseVisualStyleBackColor = true;
|
||||||
|
btnSave.Click += btnSave_Click;
|
||||||
|
//
|
||||||
|
// label6
|
||||||
|
//
|
||||||
|
label6.AutoSize = true;
|
||||||
|
label6.Location = new Point(6, 338);
|
||||||
|
label6.Name = "label6";
|
||||||
|
label6.Size = new Size(44, 17);
|
||||||
|
label6.TabIndex = 16;
|
||||||
|
label6.Text = "结果:";
|
||||||
|
//
|
||||||
|
// lblResult
|
||||||
|
//
|
||||||
|
lblResult.AutoSize = true;
|
||||||
|
lblResult.Location = new Point(56, 338);
|
||||||
|
lblResult.Name = "lblResult";
|
||||||
|
lblResult.Size = new Size(20, 17);
|
||||||
|
lblResult.TabIndex = 17;
|
||||||
|
lblResult.Text = "无";
|
||||||
|
//
|
||||||
|
// panelGuide
|
||||||
|
//
|
||||||
|
panelGuide.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
panelGuide.Controls.Add(lblResult);
|
||||||
|
panelGuide.Controls.Add(label6);
|
||||||
|
panelGuide.Controls.Add(btnSave);
|
||||||
|
panelGuide.Controls.Add(btnCreateCircle);
|
||||||
|
panelGuide.Controls.Add(btnLoadImage);
|
||||||
|
panelGuide.Controls.Add(groupBox1);
|
||||||
|
panelGuide.Controls.Add(ctrlTitleBar);
|
||||||
|
panelGuide.Controls.Add(lblElapsed);
|
||||||
|
panelGuide.Controls.Add(btnExecute);
|
||||||
|
panelGuide.Controls.Add(label4);
|
||||||
|
panelGuide.Dock = DockStyle.Fill;
|
||||||
|
panelGuide.Location = new Point(0, 0);
|
||||||
|
panelGuide.Name = "panelGuide";
|
||||||
|
panelGuide.Size = new Size(200, 640);
|
||||||
|
panelGuide.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// GuideCircleCtrl
|
||||||
|
//
|
||||||
|
Controls.Add(splitContainer);
|
||||||
|
Controls.Add(btnClose);
|
||||||
|
Name = "GuideCircleCtrl";
|
||||||
|
Size = new Size(1280, 640);
|
||||||
|
splitContainer.Panel1.ResumeLayout(false);
|
||||||
|
splitContainer.Panel2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)splitContainer).EndInit();
|
||||||
|
splitContainer.ResumeLayout(false);
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
panel1.PerformLayout();
|
||||||
|
statusStrip1.ResumeLayout(false);
|
||||||
|
statusStrip1.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)btnClose).EndInit();
|
||||||
|
groupBox1.ResumeLayout(false);
|
||||||
|
groupBox1.PerformLayout();
|
||||||
|
panelGuide.ResumeLayout(false);
|
||||||
|
panelGuide.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private SplitContainer splitContainer;
|
||||||
|
private Panel panel1;
|
||||||
|
private Canvas.UI.FlyCanvas canvas;
|
||||||
|
private StatusStrip statusStrip1;
|
||||||
|
private ToolStripStatusLabel lblStatus;
|
||||||
|
private PictureBox btnClose;
|
||||||
|
private Panel panelGuide;
|
||||||
|
private Label lblResult;
|
||||||
|
private Label label6;
|
||||||
|
private Button btnSave;
|
||||||
|
private Button btnCreateCircle;
|
||||||
|
private Button btnLoadImage;
|
||||||
|
private GroupBox groupBox1;
|
||||||
|
private TextBox tbX;
|
||||||
|
private TextBox tbY;
|
||||||
|
private TextBox tbR;
|
||||||
|
private Label label3;
|
||||||
|
private Label label2;
|
||||||
|
private Label label1;
|
||||||
|
private SizeCtrlTitleBar ctrlTitleBar;
|
||||||
|
private Label lblElapsed;
|
||||||
|
private Button btnExecute;
|
||||||
|
private Label label4;
|
||||||
|
}
|
||||||
|
}
|
361
CanFly/UI/SizePanel/SizeGuideCircleCtrl.cs
Normal file
361
CanFly/UI/SizePanel/SizeGuideCircleCtrl.cs
Normal file
@@ -0,0 +1,361 @@
|
|||||||
|
using CanFly.Canvas.Shape;
|
||||||
|
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 CanFly.Canvas.Helper;
|
||||||
|
using CanFly.Helper;
|
||||||
|
using HalconDotNet;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using CanFly.Canvas.UI;
|
||||||
|
|
||||||
|
|
||||||
|
namespace CanFly.UI.SizePanel
|
||||||
|
{
|
||||||
|
public partial class SizeGuideCircleCtrl : SizeBaseGuideControl
|
||||||
|
{
|
||||||
|
|
||||||
|
private float _x;
|
||||||
|
private float _y;
|
||||||
|
private float _r;
|
||||||
|
private FlyShape? _circle;
|
||||||
|
|
||||||
|
|
||||||
|
protected override string GetScriptFileName() => "CircleMeasure.hdvp";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public SizeGuideCircleCtrl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
||||||
|
this.canvas.mouseMoved += Canvas_mouseMoved;
|
||||||
|
this.canvas.OnShapeUpdateEvent += UpdateShape;
|
||||||
|
this.canvas.selectionChanged += Canvas_selectionChanged;
|
||||||
|
|
||||||
|
this.canvas.OnShapeMoving += Canvas_OnShapeMoving;
|
||||||
|
this.canvas.newShape += Canvas_newShape;
|
||||||
|
|
||||||
|
this.ctrlTitleBar.OnCloseClicked += OnControlClose;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected override void UpdateShape(FlyShape shape)
|
||||||
|
{
|
||||||
|
this._circle = shape;
|
||||||
|
|
||||||
|
_x = shape.Points[0].X;
|
||||||
|
_y = shape.Points[0].Y;
|
||||||
|
_r = PointHelper.Distance(shape.Points[0], shape.Points[1]);
|
||||||
|
|
||||||
|
this.tbX.Text = shape.Points[0].X.ToString("F3");
|
||||||
|
this.tbY.Text = shape.Points[0].Y.ToString("F3");
|
||||||
|
this.tbR.Text = _r.ToString("F3");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void btnExecute_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if (this.canvas.pixmap == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先打开图片");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(this.tbX.Text.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先创建圆形");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.canvas.OutsideShapes.Clear();
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
|
||||||
|
flag = new List<double>();
|
||||||
|
x = new List<double>();
|
||||||
|
y = new List<double>();
|
||||||
|
r = new List<double>();
|
||||||
|
Dictionary<string, HObject> inputImg = new Dictionary<string, HObject>();
|
||||||
|
|
||||||
|
if (hImage == null)
|
||||||
|
{
|
||||||
|
HOperatorSet.ReadImage(out hImage, CurrentImageFile);
|
||||||
|
}
|
||||||
|
inputImg["INPUT_Image"] = hImage;
|
||||||
|
|
||||||
|
Dictionary<string, HTuple> inputPara = new Dictionary<string, HTuple>();
|
||||||
|
|
||||||
|
|
||||||
|
inputPara["XCenter"] = _x;
|
||||||
|
inputPara["YCenter"] = _y;
|
||||||
|
inputPara["Radius"] = _r;
|
||||||
|
|
||||||
|
|
||||||
|
List<string> outputKeys = new List<string>()
|
||||||
|
{
|
||||||
|
"OUTPUT_PreTreatedImage",
|
||||||
|
"OUTPUT_Flag",
|
||||||
|
"RXCenter",
|
||||||
|
"RYCenter",
|
||||||
|
"RRadius"
|
||||||
|
};
|
||||||
|
|
||||||
|
ExecuteHScript(
|
||||||
|
inputImg,
|
||||||
|
inputPara,
|
||||||
|
outputKeys);
|
||||||
|
|
||||||
|
}
|
||||||
|
List<double> flag = new List<double>(), x=new List<double>(),y=new List<double>(),r=new List<double>();
|
||||||
|
|
||||||
|
protected override void OnExecuteHScriptResult(
|
||||||
|
bool success,
|
||||||
|
Dictionary<string, HTuple> resultDic,
|
||||||
|
int timeElasped)
|
||||||
|
{
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
"OUTPUT_Flag",
|
||||||
|
"RXCenter",
|
||||||
|
"RYCenter",
|
||||||
|
"RRadius"
|
||||||
|
*/
|
||||||
|
|
||||||
|
//取图?????
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
flag = resultDic["OUTPUT_Flag"].HTupleToDouble();
|
||||||
|
x = resultDic["RXCenter"].HTupleToDouble();
|
||||||
|
y = resultDic["RYCenter"].HTupleToDouble();
|
||||||
|
r = resultDic["RRadius"].HTupleToDouble();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (flag.Count > 0)
|
||||||
|
{
|
||||||
|
lblResult.Text = flag[0].ToString();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblResult.Text = "无";
|
||||||
|
}
|
||||||
|
if (flag.Count > 0 && x.Count > 0 && y.Count > 0 && r.Count > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
//detectResult.VisionImageSet.MLImage = resultDic["RRadius"].GetResultObject("OUTPUT_PreTreatedImage");
|
||||||
|
this.canvas.DrawCircle(new PointF((float)x[0], (float)y[0]), (float)r[0]);
|
||||||
|
lblElapsed.Text = $"{timeElasped} ms";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Test()
|
||||||
|
{
|
||||||
|
string filePath = Path.Combine(_hScriptsDir, GetScriptFileName());
|
||||||
|
if (!File.Exists(filePath))
|
||||||
|
{
|
||||||
|
MessageBox.Show($"文件 {filePath} 不存在");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HDevEngineTool tool = new HDevEngineTool(_hScriptsDir);
|
||||||
|
tool.LoadProcedure(Path.GetFileNameWithoutExtension(GetScriptFileName()));
|
||||||
|
|
||||||
|
|
||||||
|
if (hImage == null)
|
||||||
|
{
|
||||||
|
HOperatorSet.ReadImage(out hImage, CurrentImageFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
tool.InputImageDic["INPUT_Image"] = hImage;
|
||||||
|
tool.InputTupleDic["XCenter"] = _x;
|
||||||
|
tool.InputTupleDic["YCenter"] = _y;
|
||||||
|
tool.InputTupleDic["Radius"] = _r;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!tool.RunProcedure(out string error, out int timeElasped))
|
||||||
|
{
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
HTuple hFlag = tool.GetResultTuple("OUTPUT_Flag");
|
||||||
|
|
||||||
|
var flag = tool.GetResultTuple("OUTPUT_Flag").HTupleToDouble();
|
||||||
|
List<double> x = tool.GetResultTuple("RXCenter").HTupleToDouble();
|
||||||
|
var y = tool.GetResultTuple("RYCenter").HTupleToDouble();
|
||||||
|
var r = tool.GetResultTuple("RRadius").HTupleToDouble();
|
||||||
|
if (flag.Count > 0)
|
||||||
|
{
|
||||||
|
lblResult.Text = flag[0].ToString();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblResult.Text = "无";
|
||||||
|
}
|
||||||
|
if (flag.Count > 0 && x.Count > 0 && y.Count > 0 && r.Count > 0)
|
||||||
|
{
|
||||||
|
this.canvas.DrawCircle(new PointF((float)x[0], (float)y[0]), (float)r[0]);
|
||||||
|
lblElapsed.Text = $"{timeElasped} ms";
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Debug.WriteLine("");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
hImage?.Dispose();
|
||||||
|
hImage = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void btnClose_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OnControlCloseEvent?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnLoadImage_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OpenImageFile(bitmap =>
|
||||||
|
{
|
||||||
|
this.canvas.LoadPixmap(bitmap);
|
||||||
|
this.canvas.Enabled = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_mouseMoved(PointF pos)
|
||||||
|
{
|
||||||
|
if (InvokeRequired)
|
||||||
|
{
|
||||||
|
Invoke(Canvas_mouseMoved, pos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lblStatus.Text = $"X:{pos.X}, Y:{pos.Y}";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_selectionChanged(List<FlyShape> shapes)
|
||||||
|
{
|
||||||
|
//if (shapes.Count != 1)
|
||||||
|
//{
|
||||||
|
// // panelGuide.Controls.Clear();
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
//SwitchGuideForm(shapes[0].ShapeType);
|
||||||
|
// Canvas_OnShapeUpdateEvent(shapes[0]);
|
||||||
|
|
||||||
|
if (shapes.Count != 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UpdateShape(shapes[0]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_OnShapeMoving(List<FlyShape> shapes)
|
||||||
|
{
|
||||||
|
if (shapes.Count != 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateShape(shapes[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnCreateCircle_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (this.canvas.pixmap == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先打开图片");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.tbX.Text = string.Empty;
|
||||||
|
this.tbY.Text = string.Empty;
|
||||||
|
this.tbR.Text = string.Empty;
|
||||||
|
this.canvas.Shapes.Clear();
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
this.canvas.StartDraw(ShapeTypeEnum.Circle);
|
||||||
|
this.canvas.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_newShape()
|
||||||
|
{
|
||||||
|
|
||||||
|
this.canvas.StopDraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (lblResult.Text.Equals("无"))
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先进行绘制");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(lblResult.Text != "0")
|
||||||
|
{
|
||||||
|
MessageBox.Show("测量计算错误,无法保存");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//List<double> x = tool.GetResultTuple("RXCenter").HTupleToDouble();
|
||||||
|
//var y = tool.GetResultTuple("RYCenter").HTupleToDouble();
|
||||||
|
//var r = tool.GetResultTuple("RRadius").HTupleToDouble();
|
||||||
|
//tool.InputTupleDic["XCenter"] = _x;
|
||||||
|
//tool.InputTupleDic["YCenter"] = _y;
|
||||||
|
//tool.InputTupleDic["Radius"] = _r;
|
||||||
|
string inputput = $"XCenter:{string.Join(";", _x)};YCenter:{string.Join(";", _y)};RRadius:{string.Join(";", _r)}";
|
||||||
|
string output = $"RXCenter:{string.Join(";", x[0])};RYCenter:{string.Join(";", y[0])};RRadius:{string.Join(";", r[0])}";
|
||||||
|
|
||||||
|
DataToTriggerEvent(inputput,output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -117,4 +117,29 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<data name="canvas.OutsideShapes" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>
|
||||||
|
AAEAAAD/////AQAAAAAAAAAMAgAAAERDYW5GbHkuQ2FudmFzLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1
|
||||||
|
cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAQBAAAAdlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5l
|
||||||
|
cmljLkxpc3RgMVtbQ2FuRmx5LkNhbnZhcy5TaGFwZS5GbHlTaGFwZSwgQ2FuRmx5LkNhbnZhcywgQ3Vs
|
||||||
|
dHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsXV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lv
|
||||||
|
bgQAAB5DYW5GbHkuQ2FudmFzLlNoYXBlLkZseVNoYXBlW10CAAAACAgJAwAAAAAAAAAAAAAADAQAAAAz
|
||||||
|
Q2FuRmx5LkNhbnZhcywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBwMAAAAAAQAA
|
||||||
|
AAAAAAAEHENhbkZseS5DYW52YXMuU2hhcGUuRmx5U2hhcGUEAAAACw==
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<data name="canvas.Shapes" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>
|
||||||
|
AAEAAAD/////AQAAAAAAAAAMAgAAAERDYW5GbHkuQ2FudmFzLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1
|
||||||
|
cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAQBAAAAdlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5l
|
||||||
|
cmljLkxpc3RgMVtbQ2FuRmx5LkNhbnZhcy5TaGFwZS5GbHlTaGFwZSwgQ2FuRmx5LkNhbnZhcywgQ3Vs
|
||||||
|
dHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsXV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lv
|
||||||
|
bgQAAB5DYW5GbHkuQ2FudmFzLlNoYXBlLkZseVNoYXBlW10CAAAACAgJAwAAAAAAAAAAAAAADAQAAAAz
|
||||||
|
Q2FuRmx5LkNhbnZhcywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBwMAAAAAAQAA
|
||||||
|
AAAAAAAEHENhbkZseS5DYW52YXMuU2hhcGUuRmx5U2hhcGUEAAAACw==
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
471
CanFly/UI/SizePanel/SizeGuideHeightCtrl.Designer.cs
generated
Normal file
471
CanFly/UI/SizePanel/SizeGuideHeightCtrl.Designer.cs
generated
Normal file
@@ -0,0 +1,471 @@
|
|||||||
|
namespace CanFly.UI.SizePanel
|
||||||
|
{
|
||||||
|
partial class SizeGuideHeightCtrl
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SizeGuideHeightCtrl));
|
||||||
|
splitter1 = new AntdUI.Splitter();
|
||||||
|
panel1 = new AntdUI.Panel();
|
||||||
|
canvas = new Canvas.UI.FlyCanvas();
|
||||||
|
panel2 = new AntdUI.Panel();
|
||||||
|
ctrlTitleBar = new GuidePanel.CtrlTitleBar();
|
||||||
|
statusStrip1 = new StatusStrip();
|
||||||
|
lblStatus = new ToolStripStatusLabel();
|
||||||
|
groupBox2 = new GroupBox();
|
||||||
|
tbLineX1 = new AntdUI.Input();
|
||||||
|
label1 = new AntdUI.Label();
|
||||||
|
label4 = new AntdUI.Label();
|
||||||
|
tbLineY1 = new AntdUI.Input();
|
||||||
|
label3 = new AntdUI.Label();
|
||||||
|
tbLineY2 = new AntdUI.Input();
|
||||||
|
label5 = new AntdUI.Label();
|
||||||
|
tbLineX2 = new AntdUI.Input();
|
||||||
|
label6 = new AntdUI.Label();
|
||||||
|
label7 = new AntdUI.Label();
|
||||||
|
tbwidth = new AntdUI.Input();
|
||||||
|
tbheight = new AntdUI.Input();
|
||||||
|
label2 = new AntdUI.Label();
|
||||||
|
CamName = new AntdUI.Input();
|
||||||
|
groupBox1 = new GroupBox();
|
||||||
|
switch1 = new AntdUI.Switch();
|
||||||
|
label8 = new AntdUI.Label();
|
||||||
|
button1 = new AntdUI.Button();
|
||||||
|
button2 = new AntdUI.Button();
|
||||||
|
button3 = new AntdUI.Button();
|
||||||
|
label9 = new AntdUI.Label();
|
||||||
|
lblElapsed = new AntdUI.Label();
|
||||||
|
lblResult = new AntdUI.Label();
|
||||||
|
label12 = new AntdUI.Label();
|
||||||
|
btnSave = new AntdUI.Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)splitter1).BeginInit();
|
||||||
|
splitter1.Panel1.SuspendLayout();
|
||||||
|
splitter1.Panel2.SuspendLayout();
|
||||||
|
splitter1.SuspendLayout();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
panel2.SuspendLayout();
|
||||||
|
statusStrip1.SuspendLayout();
|
||||||
|
groupBox2.SuspendLayout();
|
||||||
|
groupBox1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// splitter1
|
||||||
|
//
|
||||||
|
splitter1.Dock = DockStyle.Fill;
|
||||||
|
splitter1.Location = new Point(0, 0);
|
||||||
|
splitter1.Name = "splitter1";
|
||||||
|
//
|
||||||
|
// splitter1.Panel1
|
||||||
|
//
|
||||||
|
splitter1.Panel1.Controls.Add(panel2);
|
||||||
|
//
|
||||||
|
// splitter1.Panel2
|
||||||
|
//
|
||||||
|
splitter1.Panel2.Controls.Add(panel1);
|
||||||
|
splitter1.Size = new Size(1280, 640);
|
||||||
|
splitter1.SplitterDistance = 286;
|
||||||
|
splitter1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(statusStrip1);
|
||||||
|
panel1.Controls.Add(canvas);
|
||||||
|
panel1.Dock = DockStyle.Fill;
|
||||||
|
panel1.Location = new Point(0, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(990, 640);
|
||||||
|
panel1.TabIndex = 0;
|
||||||
|
panel1.Text = "panel1";
|
||||||
|
//
|
||||||
|
// canvas
|
||||||
|
//
|
||||||
|
canvas.AllowMultiSelect = false;
|
||||||
|
canvas.CreateMode = Canvas.Shape.ShapeTypeEnum.Polygon;
|
||||||
|
canvas.Dock = DockStyle.Fill;
|
||||||
|
canvas.FillDrawing = false;
|
||||||
|
canvas.Location = new Point(0, 0);
|
||||||
|
canvas.Margin = new Padding(2);
|
||||||
|
canvas.Name = "canvas";
|
||||||
|
canvas.OutsideShapes = (List<Canvas.Shape.FlyShape>)resources.GetObject("canvas.OutsideShapes");
|
||||||
|
canvas.Scale = 1F;
|
||||||
|
canvas.Shapes = (List<Canvas.Shape.FlyShape>)resources.GetObject("canvas.Shapes");
|
||||||
|
canvas.Size = new Size(990, 640);
|
||||||
|
canvas.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// panel2
|
||||||
|
//
|
||||||
|
panel2.Controls.Add(btnSave);
|
||||||
|
panel2.Controls.Add(lblResult);
|
||||||
|
panel2.Controls.Add(label12);
|
||||||
|
panel2.Controls.Add(lblElapsed);
|
||||||
|
panel2.Controls.Add(label9);
|
||||||
|
panel2.Controls.Add(button3);
|
||||||
|
panel2.Controls.Add(button2);
|
||||||
|
panel2.Controls.Add(groupBox1);
|
||||||
|
panel2.Controls.Add(groupBox2);
|
||||||
|
panel2.Controls.Add(ctrlTitleBar);
|
||||||
|
panel2.Dock = DockStyle.Fill;
|
||||||
|
panel2.Location = new Point(0, 0);
|
||||||
|
panel2.Name = "panel2";
|
||||||
|
panel2.Size = new Size(286, 640);
|
||||||
|
panel2.TabIndex = 0;
|
||||||
|
panel2.Text = "panel2";
|
||||||
|
//
|
||||||
|
// ctrlTitleBar
|
||||||
|
//
|
||||||
|
ctrlTitleBar.Dock = DockStyle.Top;
|
||||||
|
ctrlTitleBar.Location = new Point(0, 0);
|
||||||
|
ctrlTitleBar.MinimumSize = new Size(0, 36);
|
||||||
|
ctrlTitleBar.Name = "ctrlTitleBar";
|
||||||
|
ctrlTitleBar.Padding = new Padding(3);
|
||||||
|
ctrlTitleBar.Size = new Size(286, 36);
|
||||||
|
ctrlTitleBar.TabIndex = 12;
|
||||||
|
ctrlTitleBar.Title = "高度测量";
|
||||||
|
//
|
||||||
|
// statusStrip1
|
||||||
|
//
|
||||||
|
statusStrip1.Items.AddRange(new ToolStripItem[] { lblStatus });
|
||||||
|
statusStrip1.Location = new Point(0, 618);
|
||||||
|
statusStrip1.Name = "statusStrip1";
|
||||||
|
statusStrip1.Size = new Size(990, 22);
|
||||||
|
statusStrip1.TabIndex = 2;
|
||||||
|
statusStrip1.Text = "statusStrip1";
|
||||||
|
//
|
||||||
|
// lblStatus
|
||||||
|
//
|
||||||
|
lblStatus.Name = "lblStatus";
|
||||||
|
lblStatus.Size = new Size(44, 17);
|
||||||
|
lblStatus.Text = " ";
|
||||||
|
//
|
||||||
|
// groupBox2
|
||||||
|
//
|
||||||
|
groupBox2.Controls.Add(tbheight);
|
||||||
|
groupBox2.Controls.Add(tbwidth);
|
||||||
|
groupBox2.Controls.Add(label7);
|
||||||
|
groupBox2.Controls.Add(label6);
|
||||||
|
groupBox2.Controls.Add(label3);
|
||||||
|
groupBox2.Controls.Add(tbLineY2);
|
||||||
|
groupBox2.Controls.Add(label5);
|
||||||
|
groupBox2.Controls.Add(tbLineX2);
|
||||||
|
groupBox2.Controls.Add(label4);
|
||||||
|
groupBox2.Controls.Add(tbLineY1);
|
||||||
|
groupBox2.Controls.Add(label1);
|
||||||
|
groupBox2.Controls.Add(tbLineX1);
|
||||||
|
groupBox2.Dock = DockStyle.Top;
|
||||||
|
groupBox2.Location = new Point(0, 36);
|
||||||
|
groupBox2.Name = "groupBox2";
|
||||||
|
groupBox2.Size = new Size(286, 229);
|
||||||
|
groupBox2.TabIndex = 14;
|
||||||
|
groupBox2.TabStop = false;
|
||||||
|
groupBox2.Text = "线参数";
|
||||||
|
//
|
||||||
|
// tbLineX1
|
||||||
|
//
|
||||||
|
tbLineX1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLineX1.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
tbLineX1.Location = new Point(62, 22);
|
||||||
|
tbLineX1.Name = "tbLineX1";
|
||||||
|
tbLineX1.Radius = 3;
|
||||||
|
tbLineX1.Size = new Size(214, 32);
|
||||||
|
tbLineX1.TabIndex = 17;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.Location = new Point(6, 22);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(38, 32);
|
||||||
|
label1.TabIndex = 19;
|
||||||
|
label1.Text = " X1:";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.Location = new Point(6, 60);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new Size(38, 32);
|
||||||
|
label4.TabIndex = 23;
|
||||||
|
label4.Text = " Y1:";
|
||||||
|
//
|
||||||
|
// tbLineY1
|
||||||
|
//
|
||||||
|
tbLineY1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLineY1.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
tbLineY1.Location = new Point(62, 60);
|
||||||
|
tbLineY1.Name = "tbLineY1";
|
||||||
|
tbLineY1.Radius = 3;
|
||||||
|
tbLineY1.Size = new Size(214, 32);
|
||||||
|
tbLineY1.TabIndex = 22;
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.Location = new Point(6, 136);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(38, 32);
|
||||||
|
label3.TabIndex = 27;
|
||||||
|
label3.Text = " Y2:";
|
||||||
|
//
|
||||||
|
// tbLineY2
|
||||||
|
//
|
||||||
|
tbLineY2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLineY2.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
tbLineY2.Location = new Point(62, 136);
|
||||||
|
tbLineY2.Name = "tbLineY2";
|
||||||
|
tbLineY2.Radius = 3;
|
||||||
|
tbLineY2.Size = new Size(214, 32);
|
||||||
|
tbLineY2.TabIndex = 26;
|
||||||
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
label5.Location = new Point(6, 98);
|
||||||
|
label5.Name = "label5";
|
||||||
|
label5.Size = new Size(38, 32);
|
||||||
|
label5.TabIndex = 25;
|
||||||
|
label5.Text = " X2:";
|
||||||
|
//
|
||||||
|
// tbLineX2
|
||||||
|
//
|
||||||
|
tbLineX2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLineX2.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
tbLineX2.Location = new Point(62, 98);
|
||||||
|
tbLineX2.Name = "tbLineX2";
|
||||||
|
tbLineX2.Radius = 3;
|
||||||
|
tbLineX2.Size = new Size(214, 32);
|
||||||
|
tbLineX2.TabIndex = 24;
|
||||||
|
//
|
||||||
|
// label6
|
||||||
|
//
|
||||||
|
label6.Location = new Point(6, 174);
|
||||||
|
label6.Name = "label6";
|
||||||
|
label6.Size = new Size(50, 32);
|
||||||
|
label6.TabIndex = 28;
|
||||||
|
label6.Text = " 宽:";
|
||||||
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
label7.Location = new Point(145, 177);
|
||||||
|
label7.Name = "label7";
|
||||||
|
label7.Size = new Size(29, 32);
|
||||||
|
label7.TabIndex = 29;
|
||||||
|
label7.Text = "高:";
|
||||||
|
//
|
||||||
|
// tbwidth
|
||||||
|
//
|
||||||
|
tbwidth.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbwidth.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
tbwidth.Location = new Point(62, 177);
|
||||||
|
tbwidth.Name = "tbwidth";
|
||||||
|
tbwidth.Radius = 3;
|
||||||
|
tbwidth.Size = new Size(77, 32);
|
||||||
|
tbwidth.TabIndex = 30;
|
||||||
|
//
|
||||||
|
// tbheight
|
||||||
|
//
|
||||||
|
tbheight.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbheight.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
tbheight.Location = new Point(180, 177);
|
||||||
|
tbheight.Name = "tbheight";
|
||||||
|
tbheight.Radius = 3;
|
||||||
|
tbheight.Size = new Size(96, 32);
|
||||||
|
tbheight.TabIndex = 31;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.Location = new Point(6, 22);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(55, 32);
|
||||||
|
label2.TabIndex = 1;
|
||||||
|
label2.Text = "相机名:";
|
||||||
|
//
|
||||||
|
// CamName
|
||||||
|
//
|
||||||
|
CamName.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
CamName.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
CamName.Location = new Point(64, 22);
|
||||||
|
CamName.Name = "CamName";
|
||||||
|
CamName.Radius = 3;
|
||||||
|
CamName.ReadOnly = true;
|
||||||
|
CamName.Size = new Size(212, 32);
|
||||||
|
CamName.TabIndex = 18;
|
||||||
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
groupBox1.Controls.Add(button1);
|
||||||
|
groupBox1.Controls.Add(label8);
|
||||||
|
groupBox1.Controls.Add(switch1);
|
||||||
|
groupBox1.Controls.Add(label2);
|
||||||
|
groupBox1.Controls.Add(CamName);
|
||||||
|
groupBox1.Dock = DockStyle.Top;
|
||||||
|
groupBox1.Location = new Point(0, 265);
|
||||||
|
groupBox1.Name = "groupBox1";
|
||||||
|
groupBox1.Size = new Size(286, 105);
|
||||||
|
groupBox1.TabIndex = 19;
|
||||||
|
groupBox1.TabStop = false;
|
||||||
|
groupBox1.Text = "相机控制";
|
||||||
|
//
|
||||||
|
// switch1
|
||||||
|
//
|
||||||
|
switch1.Location = new Point(67, 60);
|
||||||
|
switch1.Name = "switch1";
|
||||||
|
switch1.Size = new Size(72, 32);
|
||||||
|
switch1.TabIndex = 19;
|
||||||
|
switch1.Text = "switch1";
|
||||||
|
//
|
||||||
|
// label8
|
||||||
|
//
|
||||||
|
label8.Location = new Point(6, 60);
|
||||||
|
label8.Name = "label8";
|
||||||
|
label8.Size = new Size(55, 32);
|
||||||
|
label8.TabIndex = 20;
|
||||||
|
label8.Text = "硬触发:";
|
||||||
|
//
|
||||||
|
// button1
|
||||||
|
//
|
||||||
|
button1.Location = new Point(145, 60);
|
||||||
|
button1.Name = "button1";
|
||||||
|
button1.Size = new Size(131, 32);
|
||||||
|
button1.TabIndex = 21;
|
||||||
|
button1.Text = "软触发一次";
|
||||||
|
//
|
||||||
|
// button2
|
||||||
|
//
|
||||||
|
button2.Location = new Point(0, 376);
|
||||||
|
button2.Name = "button2";
|
||||||
|
button2.Size = new Size(276, 37);
|
||||||
|
button2.TabIndex = 22;
|
||||||
|
button2.Text = "创建矩形";
|
||||||
|
button2.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
//
|
||||||
|
// button3
|
||||||
|
//
|
||||||
|
button3.Location = new Point(0, 419);
|
||||||
|
button3.Name = "button3";
|
||||||
|
button3.Size = new Size(276, 36);
|
||||||
|
button3.TabIndex = 23;
|
||||||
|
button3.Text = "执行";
|
||||||
|
button3.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
//
|
||||||
|
// label9
|
||||||
|
//
|
||||||
|
label9.Location = new Point(6, 461);
|
||||||
|
label9.Name = "label9";
|
||||||
|
label9.Size = new Size(50, 23);
|
||||||
|
label9.TabIndex = 24;
|
||||||
|
label9.Text = "耗时:";
|
||||||
|
//
|
||||||
|
// lblElapsed
|
||||||
|
//
|
||||||
|
lblElapsed.Location = new Point(67, 461);
|
||||||
|
lblElapsed.Name = "lblElapsed";
|
||||||
|
lblElapsed.Size = new Size(72, 23);
|
||||||
|
lblElapsed.TabIndex = 25;
|
||||||
|
lblElapsed.Text = "0 ms";
|
||||||
|
//
|
||||||
|
// lblResult
|
||||||
|
//
|
||||||
|
lblResult.Location = new Point(67, 490);
|
||||||
|
lblResult.Name = "lblResult";
|
||||||
|
lblResult.Size = new Size(72, 23);
|
||||||
|
lblResult.TabIndex = 27;
|
||||||
|
lblResult.Text = "无";
|
||||||
|
//
|
||||||
|
// label12
|
||||||
|
//
|
||||||
|
label12.Location = new Point(6, 490);
|
||||||
|
label12.Name = "label12";
|
||||||
|
label12.Size = new Size(50, 23);
|
||||||
|
label12.TabIndex = 26;
|
||||||
|
label12.Text = "结果:";
|
||||||
|
//
|
||||||
|
// btnSave
|
||||||
|
//
|
||||||
|
btnSave.Location = new Point(0, 519);
|
||||||
|
btnSave.Name = "btnSave";
|
||||||
|
btnSave.Size = new Size(276, 36);
|
||||||
|
btnSave.TabIndex = 28;
|
||||||
|
btnSave.Text = "保存数据";
|
||||||
|
btnSave.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
//
|
||||||
|
// SizeGuideHeightCtrl
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(splitter1);
|
||||||
|
Name = "SizeGuideHeightCtrl";
|
||||||
|
Size = new Size(1280, 640);
|
||||||
|
Load += GuideLineCircleCtrl_Load;
|
||||||
|
splitter1.Panel1.ResumeLayout(false);
|
||||||
|
splitter1.Panel2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)splitter1).EndInit();
|
||||||
|
splitter1.ResumeLayout(false);
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
panel1.PerformLayout();
|
||||||
|
panel2.ResumeLayout(false);
|
||||||
|
statusStrip1.ResumeLayout(false);
|
||||||
|
statusStrip1.PerformLayout();
|
||||||
|
groupBox2.ResumeLayout(false);
|
||||||
|
groupBox1.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
private TextBox tbRectWidth1;
|
||||||
|
private AntdUI.Splitter splitter1;
|
||||||
|
private AntdUI.Panel panel1;
|
||||||
|
private Canvas.UI.FlyCanvas canvas;
|
||||||
|
private AntdUI.Panel panel2;
|
||||||
|
private GuidePanel.CtrlTitleBar ctrlTitleBar;
|
||||||
|
private StatusStrip statusStrip1;
|
||||||
|
private ToolStripStatusLabel lblStatus;
|
||||||
|
private GroupBox groupBox2;
|
||||||
|
|
||||||
|
private Canvas.UI.FlyCanvas flyCanvas1;
|
||||||
|
private AntdUI.Input tbLineX1;
|
||||||
|
private AntdUI.Label label1;
|
||||||
|
private AntdUI.Label label3;
|
||||||
|
private AntdUI.Input tbLineY2;
|
||||||
|
private AntdUI.Label label5;
|
||||||
|
private AntdUI.Input tbLineX2;
|
||||||
|
private AntdUI.Label label4;
|
||||||
|
private AntdUI.Input tbLineY1;
|
||||||
|
private AntdUI.Label label7;
|
||||||
|
private AntdUI.Label label6;
|
||||||
|
private AntdUI.Input tbwidth;
|
||||||
|
private AntdUI.Input tbheight;
|
||||||
|
private GroupBox groupBox1;
|
||||||
|
private AntdUI.Label label2;
|
||||||
|
private AntdUI.Input CamName;
|
||||||
|
private AntdUI.Button button1;
|
||||||
|
private AntdUI.Label label8;
|
||||||
|
private AntdUI.Switch switch1;
|
||||||
|
private AntdUI.Button button2;
|
||||||
|
private AntdUI.Button button3;
|
||||||
|
private AntdUI.Label lblElapsed;
|
||||||
|
private AntdUI.Label label9;
|
||||||
|
private AntdUI.Label lblResult;
|
||||||
|
private AntdUI.Label label12;
|
||||||
|
private AntdUI.Button btnSave;
|
||||||
|
}
|
||||||
|
}
|
346
CanFly/UI/SizePanel/SizeGuideHeightCtrl.cs
Normal file
346
CanFly/UI/SizePanel/SizeGuideHeightCtrl.cs
Normal file
@@ -0,0 +1,346 @@
|
|||||||
|
using CanFly.Canvas.Helper;
|
||||||
|
using CanFly.Canvas.Shape;
|
||||||
|
using CanFly.Canvas.UI;
|
||||||
|
using CanFly.Helper;
|
||||||
|
using HalconDotNet;
|
||||||
|
using OpenCvSharp;
|
||||||
|
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;
|
||||||
|
|
||||||
|
namespace CanFly.UI.SizePanel
|
||||||
|
{
|
||||||
|
public partial class SizeGuideHeightCtrl : SizeBaseGuideControl
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private FlyShape? _line;
|
||||||
|
|
||||||
|
|
||||||
|
private float _lineX1;
|
||||||
|
private float _lineY1;
|
||||||
|
private float _lineX2;
|
||||||
|
private float _lineY2;
|
||||||
|
float width, height;
|
||||||
|
private float _lineWidth;
|
||||||
|
private PointF[] _rectPoints = new PointF[4];
|
||||||
|
//private float _LineLX=new float();
|
||||||
|
//private float _LineLY =new float();
|
||||||
|
//private float _LineRX =new float();
|
||||||
|
//private float _LineRY =new float();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected override string GetScriptFileName() => "HeightMeasure.hdvp";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public SizeGuideHeightCtrl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.canvas.mouseMoved += Canvas_mouseMoved;
|
||||||
|
this.canvas.OnShapeUpdateEvent += UpdateShape;
|
||||||
|
this.canvas.selectionChanged += Canvas_selectionChanged;
|
||||||
|
|
||||||
|
this.canvas.OnShapeMoving += Canvas_OnShapeMoving;
|
||||||
|
this.canvas.newShape += Canvas_newShape;
|
||||||
|
|
||||||
|
this.ctrlTitleBar.OnCloseClicked += OnControlClose;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected override void UpdateShape(FlyShape shape)
|
||||||
|
{
|
||||||
|
switch (shape.ShapeType)
|
||||||
|
{
|
||||||
|
case ShapeTypeEnum.Rectangle:
|
||||||
|
this._line = shape;
|
||||||
|
|
||||||
|
var pts = this._line.Points;
|
||||||
|
|
||||||
|
_lineX1 = pts[0].X;
|
||||||
|
_lineY1 = pts[0].Y;
|
||||||
|
_lineX2 = pts[1].X;
|
||||||
|
_lineY2 = pts[1].Y;
|
||||||
|
_lineWidth = shape.LineVirtualRectWidth;
|
||||||
|
_rectPoints = shape.LineVirtualRectPoints;
|
||||||
|
//_LineLX = (shape.LineVirtualRectPoints[0].X + shape.LineVirtualRectPoints[3].X) / 2;
|
||||||
|
//_LineLY = (shape.LineVirtualRectPoints[0].Y + shape.LineVirtualRectPoints[3].Y) / 2;
|
||||||
|
//_LineRX = (shape.LineVirtualRectPoints[1].X + shape.LineVirtualRectPoints[2].X) / 2;
|
||||||
|
//_LineRY = (shape.LineVirtualRectPoints[1].Y + shape.LineVirtualRectPoints[2].Y) / 2;
|
||||||
|
|
||||||
|
width = Math.Abs(_lineX2 - _lineX1);
|
||||||
|
height = Math.Abs(_lineY2 - _lineY1);
|
||||||
|
|
||||||
|
|
||||||
|
tbLineX1.Text = _lineX1.ToString("F3");
|
||||||
|
tbLineY1.Text = _lineY1.ToString("F3");
|
||||||
|
tbLineX2.Text = _lineX2.ToString("F3");
|
||||||
|
tbLineY2.Text = _lineY2.ToString("F3");
|
||||||
|
tbwidth.Text = width.ToString();
|
||||||
|
tbheight.Text = height.ToString();
|
||||||
|
// NumRectWidth1.Value = (decimal)_lineWidth;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void GuideLineCircleCtrl_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_mouseMoved(PointF pos)
|
||||||
|
{
|
||||||
|
if (InvokeRequired)
|
||||||
|
{
|
||||||
|
Invoke(Canvas_mouseMoved, pos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lblStatus.Text = $"X:{pos.X}, Y:{pos.Y}";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_selectionChanged(List<FlyShape> shapes)
|
||||||
|
{
|
||||||
|
//if (shapes.Count != 1)
|
||||||
|
//{
|
||||||
|
// // panelGuide.Controls.Clear();
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
//SwitchGuideForm(shapes[0].ShapeType);
|
||||||
|
// Canvas_OnShapeUpdateEvent(shapes[0]);
|
||||||
|
|
||||||
|
if (shapes.Count != 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UpdateShape(shapes[0]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_OnShapeMoving(List<FlyShape> shapes)
|
||||||
|
{
|
||||||
|
if (shapes.Count != 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateShape(shapes[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void btnCreateLine_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (this.canvas.pixmap == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先打开图片");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tbLineX1.Text = string.Empty;
|
||||||
|
tbLineY1.Text = string.Empty;
|
||||||
|
tbLineX2.Text = string.Empty;
|
||||||
|
tbLineY2.Text = string.Empty; ;
|
||||||
|
tbwidth.Text = string.Empty; ;
|
||||||
|
tbheight.Text = string.Empty; ;
|
||||||
|
this.canvas.Shapes.RemoveAll(shp => shp.ShapeType == ShapeTypeEnum.Rectangle);
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
this.canvas.StartDraw(ShapeTypeEnum.Rectangle);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void btnLoadImage_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OpenImageFile(bitmap =>
|
||||||
|
{
|
||||||
|
this.canvas.LoadPixmap(bitmap);
|
||||||
|
this.canvas.Enabled = true;
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_newShape()
|
||||||
|
{
|
||||||
|
this.canvas.StopDraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnExecute_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (this.canvas.pixmap == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先打开图片");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.tbLineX1.Text.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先创建矩形");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.canvas.OutsideShapes.Clear();
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
|
||||||
|
|
||||||
|
flag = new List<double>();
|
||||||
|
|
||||||
|
Line1Para = new List<double>();
|
||||||
|
Line2Para = new List<double>();
|
||||||
|
iHeight = new List<double>();
|
||||||
|
Dictionary<string, HObject> inputImg = new Dictionary<string, HObject>();
|
||||||
|
|
||||||
|
if (hImage == null)
|
||||||
|
{
|
||||||
|
HOperatorSet.ReadImage(out hImage, CurrentImageFile);
|
||||||
|
}
|
||||||
|
inputImg["INPUT_Image"] = hImage;
|
||||||
|
|
||||||
|
|
||||||
|
Dictionary<string, HTuple> inputPara = new Dictionary<string, HTuple>();
|
||||||
|
|
||||||
|
|
||||||
|
inputPara["row"] = _lineY1;
|
||||||
|
inputPara["column"] = _lineX1;
|
||||||
|
inputPara["Width"] = width;
|
||||||
|
inputPara["Height"] = height;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<string> outputKeys = new List<string>()
|
||||||
|
{
|
||||||
|
"OUTPUT_PreTreatedImage",
|
||||||
|
"OUTPUT_Flag",
|
||||||
|
|
||||||
|
"Line1Para",
|
||||||
|
"Line2Para",
|
||||||
|
"iHeight"
|
||||||
|
};
|
||||||
|
|
||||||
|
ExecuteHScript(
|
||||||
|
inputImg,
|
||||||
|
inputPara,
|
||||||
|
outputKeys);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<double> flag = new List<double>();
|
||||||
|
List<double> Line1Para = new List<double>();
|
||||||
|
List<double> Line2Para = new List<double>();
|
||||||
|
|
||||||
|
List<double> iHeight = new List<double>();
|
||||||
|
|
||||||
|
|
||||||
|
protected override void OnExecuteHScriptResult(
|
||||||
|
bool success,
|
||||||
|
Dictionary<string, HTuple> resultDic,
|
||||||
|
int timeElasped)
|
||||||
|
{
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
"OUTPUT_Flag",
|
||||||
|
"RXCenter",
|
||||||
|
"RYCenter",
|
||||||
|
"RRadius"
|
||||||
|
*/
|
||||||
|
|
||||||
|
flag = resultDic["OUTPUT_Flag"].HTupleToDouble();
|
||||||
|
|
||||||
|
Line1Para = resultDic["Line1Para"].HTupleToDouble();
|
||||||
|
Line2Para = resultDic["Line2Para"].HTupleToDouble();
|
||||||
|
// EndRow = resultDic["EndRow"].HTupleToDouble();
|
||||||
|
//EndCloumn = resultDic["EndColumn"].HTupleToDouble();
|
||||||
|
iHeight = resultDic["iHeight"].HTupleToDouble();
|
||||||
|
|
||||||
|
if (flag.Count > 0)
|
||||||
|
{
|
||||||
|
lblResult.Text = flag[0].ToString();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblResult.Text = "无";
|
||||||
|
}
|
||||||
|
if (flag.Count > 0 && Line1Para.Count == 4 && Line2Para.Count == 4 && iHeight.Count > 0)
|
||||||
|
{
|
||||||
|
float width = 0;
|
||||||
|
this.canvas.DrawLine(new PointF((float)Line1Para[1], (float)Line1Para[0]), new PointF((float)Line1Para[3], (float)Line1Para[2]), 0);
|
||||||
|
this.canvas.DrawLine(new PointF((float)Line2Para[1], (float)Line2Para[0]), new PointF((float)Line2Para[3], (float)Line2Para[2]), 0);
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
lblElapsed.Text = $"{timeElasped} ms";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void btnSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (lblResult.Text.Equals("无"))
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先进行绘制");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (lblResult.Text != "0")
|
||||||
|
{
|
||||||
|
MessageBox.Show("测量计算错误,无法保存");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
string input = $"row:{string.Join(";", _lineY1)};column:{string.Join(";", _lineX1)};" +
|
||||||
|
$"Width:{string.Join(";", width)};Height:{string.Join(";", height)}";
|
||||||
|
|
||||||
|
string output = $"iHeight:{string.Join(";", iHeight[0])}";
|
||||||
|
DataToTriggerEvent(input, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tbLineX1_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
148
CanFly/UI/SizePanel/SizeGuideHeightCtrl.resx
Normal file
148
CanFly/UI/SizePanel/SizeGuideHeightCtrl.resx
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
<?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="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<data name="canvas.OutsideShapes" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>
|
||||||
|
AAEAAAD/////AQAAAAAAAAAMAgAAAERDYW5GbHkuQ2FudmFzLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1
|
||||||
|
cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAQBAAAAdlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5l
|
||||||
|
cmljLkxpc3RgMVtbQ2FuRmx5LkNhbnZhcy5TaGFwZS5GbHlTaGFwZSwgQ2FuRmx5LkNhbnZhcywgQ3Vs
|
||||||
|
dHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsXV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lv
|
||||||
|
bgQAAB5DYW5GbHkuQ2FudmFzLlNoYXBlLkZseVNoYXBlW10CAAAACAgJAwAAAAAAAAAAAAAADAQAAAAz
|
||||||
|
Q2FuRmx5LkNhbnZhcywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBwMAAAAAAQAA
|
||||||
|
AAAAAAAEHENhbkZseS5DYW52YXMuU2hhcGUuRmx5U2hhcGUEAAAACw==
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<data name="canvas.Shapes" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>
|
||||||
|
AAEAAAD/////AQAAAAAAAAAMAgAAAERDYW5GbHkuQ2FudmFzLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1
|
||||||
|
cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAQBAAAAdlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5l
|
||||||
|
cmljLkxpc3RgMVtbQ2FuRmx5LkNhbnZhcy5TaGFwZS5GbHlTaGFwZSwgQ2FuRmx5LkNhbnZhcywgQ3Vs
|
||||||
|
dHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsXV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lv
|
||||||
|
bgQAAB5DYW5GbHkuQ2FudmFzLlNoYXBlLkZseVNoYXBlW10CAAAACAgJAwAAAAAAAAAAAAAADAQAAAAz
|
||||||
|
Q2FuRmx5LkNhbnZhcywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBwMAAAAAAQAA
|
||||||
|
AAAAAAAEHENhbkZseS5DYW52YXMuU2hhcGUuRmx5U2hhcGUEAAAACw==
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
550
CanFly/UI/SizePanel/SizeGuideLineCircleCtrl.Designer.cs
generated
Normal file
550
CanFly/UI/SizePanel/SizeGuideLineCircleCtrl.Designer.cs
generated
Normal file
@@ -0,0 +1,550 @@
|
|||||||
|
namespace CanFly.UI.SizePanel
|
||||||
|
{
|
||||||
|
partial class SizeGuideLineCircleCtrl
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SizeGuideLineCircleCtrl));
|
||||||
|
lblElapsed = new Label();
|
||||||
|
label4 = new Label();
|
||||||
|
splitContainer = new SplitContainer();
|
||||||
|
panelGuide = new Panel();
|
||||||
|
lblDistance = new Label();
|
||||||
|
label17 = new Label();
|
||||||
|
lblResult = new Label();
|
||||||
|
label15 = new Label();
|
||||||
|
btnCreateLine = new Button();
|
||||||
|
btnCreateCircle = new Button();
|
||||||
|
btnLoadImage = new Button();
|
||||||
|
label9 = new Label();
|
||||||
|
btnExecute = new Button();
|
||||||
|
label10 = new Label();
|
||||||
|
groupBox2 = new GroupBox();
|
||||||
|
NumRectWidth1 = new NumericUpDown();
|
||||||
|
label11 = new Label();
|
||||||
|
tbLineX2 = new TextBox();
|
||||||
|
label8 = new Label();
|
||||||
|
tbLineY2 = new TextBox();
|
||||||
|
label5 = new Label();
|
||||||
|
tbLineX1 = new TextBox();
|
||||||
|
tbLineY1 = new TextBox();
|
||||||
|
label6 = new Label();
|
||||||
|
label7 = new Label();
|
||||||
|
groupBox1 = new GroupBox();
|
||||||
|
tbCircleX = new TextBox();
|
||||||
|
tbCircleY = new TextBox();
|
||||||
|
tbCircleR = new TextBox();
|
||||||
|
label3 = new Label();
|
||||||
|
label2 = new Label();
|
||||||
|
label1 = new Label();
|
||||||
|
ctrlTitleBar = new SizeCtrlTitleBar();
|
||||||
|
panel1 = new Panel();
|
||||||
|
canvas = new Canvas.UI.FlyCanvas();
|
||||||
|
statusStrip1 = new StatusStrip();
|
||||||
|
lblStatus = new ToolStripStatusLabel();
|
||||||
|
btnSave = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)splitContainer).BeginInit();
|
||||||
|
splitContainer.Panel1.SuspendLayout();
|
||||||
|
splitContainer.Panel2.SuspendLayout();
|
||||||
|
splitContainer.SuspendLayout();
|
||||||
|
panelGuide.SuspendLayout();
|
||||||
|
groupBox2.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)NumRectWidth1).BeginInit();
|
||||||
|
groupBox1.SuspendLayout();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
statusStrip1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// lblElapsed
|
||||||
|
//
|
||||||
|
lblElapsed.AutoSize = true;
|
||||||
|
lblElapsed.Location = new Point(50, 328);
|
||||||
|
lblElapsed.Name = "lblElapsed";
|
||||||
|
lblElapsed.Size = new Size(32, 17);
|
||||||
|
lblElapsed.TabIndex = 9;
|
||||||
|
lblElapsed.Text = "0ms";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.Location = new Point(0, 328);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new Size(44, 17);
|
||||||
|
label4.TabIndex = 8;
|
||||||
|
label4.Text = "耗时:";
|
||||||
|
//
|
||||||
|
// splitContainer
|
||||||
|
//
|
||||||
|
splitContainer.Dock = DockStyle.Fill;
|
||||||
|
splitContainer.Location = new Point(0, 0);
|
||||||
|
splitContainer.Name = "splitContainer";
|
||||||
|
//
|
||||||
|
// splitContainer.Panel1
|
||||||
|
//
|
||||||
|
splitContainer.Panel1.Controls.Add(panelGuide);
|
||||||
|
splitContainer.Panel1MinSize = 150;
|
||||||
|
//
|
||||||
|
// splitContainer.Panel2
|
||||||
|
//
|
||||||
|
splitContainer.Panel2.Controls.Add(panel1);
|
||||||
|
splitContainer.Size = new Size(1280, 640);
|
||||||
|
splitContainer.SplitterDistance = 200;
|
||||||
|
splitContainer.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// panelGuide
|
||||||
|
//
|
||||||
|
panelGuide.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
panelGuide.Controls.Add(btnSave);
|
||||||
|
panelGuide.Controls.Add(lblDistance);
|
||||||
|
panelGuide.Controls.Add(label17);
|
||||||
|
panelGuide.Controls.Add(lblResult);
|
||||||
|
panelGuide.Controls.Add(label15);
|
||||||
|
panelGuide.Controls.Add(btnCreateLine);
|
||||||
|
panelGuide.Controls.Add(btnCreateCircle);
|
||||||
|
panelGuide.Controls.Add(btnLoadImage);
|
||||||
|
panelGuide.Controls.Add(label9);
|
||||||
|
panelGuide.Controls.Add(btnExecute);
|
||||||
|
panelGuide.Controls.Add(label10);
|
||||||
|
panelGuide.Controls.Add(groupBox2);
|
||||||
|
panelGuide.Controls.Add(groupBox1);
|
||||||
|
panelGuide.Controls.Add(ctrlTitleBar);
|
||||||
|
panelGuide.Dock = DockStyle.Fill;
|
||||||
|
panelGuide.Location = new Point(0, 0);
|
||||||
|
panelGuide.Name = "panelGuide";
|
||||||
|
panelGuide.Size = new Size(200, 640);
|
||||||
|
panelGuide.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// lblDistance
|
||||||
|
//
|
||||||
|
lblDistance.AutoSize = true;
|
||||||
|
lblDistance.Location = new Point(54, 505);
|
||||||
|
lblDistance.Name = "lblDistance";
|
||||||
|
lblDistance.Size = new Size(15, 17);
|
||||||
|
lblDistance.TabIndex = 29;
|
||||||
|
lblDistance.Text = "0";
|
||||||
|
//
|
||||||
|
// label17
|
||||||
|
//
|
||||||
|
label17.AutoSize = true;
|
||||||
|
label17.Location = new Point(6, 505);
|
||||||
|
label17.Name = "label17";
|
||||||
|
label17.Size = new Size(44, 17);
|
||||||
|
label17.TabIndex = 28;
|
||||||
|
label17.Text = "距离:";
|
||||||
|
//
|
||||||
|
// lblResult
|
||||||
|
//
|
||||||
|
lblResult.AutoSize = true;
|
||||||
|
lblResult.Location = new Point(54, 479);
|
||||||
|
lblResult.Name = "lblResult";
|
||||||
|
lblResult.Size = new Size(20, 17);
|
||||||
|
lblResult.TabIndex = 27;
|
||||||
|
lblResult.Text = "无";
|
||||||
|
//
|
||||||
|
// label15
|
||||||
|
//
|
||||||
|
label15.AutoSize = true;
|
||||||
|
label15.Location = new Point(6, 479);
|
||||||
|
label15.Name = "label15";
|
||||||
|
label15.Size = new Size(44, 17);
|
||||||
|
label15.TabIndex = 26;
|
||||||
|
label15.Text = "结果:";
|
||||||
|
//
|
||||||
|
// btnCreateLine
|
||||||
|
//
|
||||||
|
btnCreateLine.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnCreateLine.Location = new Point(6, 406);
|
||||||
|
btnCreateLine.Name = "btnCreateLine";
|
||||||
|
btnCreateLine.Size = new Size(186, 32);
|
||||||
|
btnCreateLine.TabIndex = 20;
|
||||||
|
btnCreateLine.Text = "创建直线";
|
||||||
|
btnCreateLine.UseVisualStyleBackColor = true;
|
||||||
|
btnCreateLine.Click += btnCreateLine_Click;
|
||||||
|
//
|
||||||
|
// btnCreateCircle
|
||||||
|
//
|
||||||
|
btnCreateCircle.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnCreateCircle.Location = new Point(6, 368);
|
||||||
|
btnCreateCircle.Name = "btnCreateCircle";
|
||||||
|
btnCreateCircle.Size = new Size(186, 32);
|
||||||
|
btnCreateCircle.TabIndex = 19;
|
||||||
|
btnCreateCircle.Text = "创建圆形";
|
||||||
|
btnCreateCircle.UseVisualStyleBackColor = true;
|
||||||
|
btnCreateCircle.Click += btnCreateCircle_Click;
|
||||||
|
//
|
||||||
|
// btnLoadImage
|
||||||
|
//
|
||||||
|
btnLoadImage.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnLoadImage.Location = new Point(6, 330);
|
||||||
|
btnLoadImage.Name = "btnLoadImage";
|
||||||
|
btnLoadImage.Size = new Size(186, 32);
|
||||||
|
btnLoadImage.TabIndex = 18;
|
||||||
|
btnLoadImage.Text = "打开图片";
|
||||||
|
btnLoadImage.UseVisualStyleBackColor = true;
|
||||||
|
btnLoadImage.Click += btnLoadImage_Click;
|
||||||
|
//
|
||||||
|
// label9
|
||||||
|
//
|
||||||
|
label9.AutoSize = true;
|
||||||
|
label9.Location = new Point(56, 525);
|
||||||
|
label9.Name = "label9";
|
||||||
|
label9.Size = new Size(32, 17);
|
||||||
|
label9.TabIndex = 17;
|
||||||
|
label9.Text = "0ms";
|
||||||
|
//
|
||||||
|
// btnExecute
|
||||||
|
//
|
||||||
|
btnExecute.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnExecute.Location = new Point(6, 444);
|
||||||
|
btnExecute.Name = "btnExecute";
|
||||||
|
btnExecute.Size = new Size(186, 32);
|
||||||
|
btnExecute.TabIndex = 15;
|
||||||
|
btnExecute.Text = "执行";
|
||||||
|
btnExecute.UseVisualStyleBackColor = true;
|
||||||
|
btnExecute.Click += btnExecute_Click;
|
||||||
|
//
|
||||||
|
// label10
|
||||||
|
//
|
||||||
|
label10.AutoSize = true;
|
||||||
|
label10.Location = new Point(6, 525);
|
||||||
|
label10.Name = "label10";
|
||||||
|
label10.Size = new Size(44, 17);
|
||||||
|
label10.TabIndex = 16;
|
||||||
|
label10.Text = "耗时:";
|
||||||
|
//
|
||||||
|
// groupBox2
|
||||||
|
//
|
||||||
|
groupBox2.Controls.Add(NumRectWidth1);
|
||||||
|
groupBox2.Controls.Add(label11);
|
||||||
|
groupBox2.Controls.Add(tbLineX2);
|
||||||
|
groupBox2.Controls.Add(label8);
|
||||||
|
groupBox2.Controls.Add(tbLineY2);
|
||||||
|
groupBox2.Controls.Add(label5);
|
||||||
|
groupBox2.Controls.Add(tbLineX1);
|
||||||
|
groupBox2.Controls.Add(tbLineY1);
|
||||||
|
groupBox2.Controls.Add(label6);
|
||||||
|
groupBox2.Controls.Add(label7);
|
||||||
|
groupBox2.Dock = DockStyle.Top;
|
||||||
|
groupBox2.Location = new Point(0, 152);
|
||||||
|
groupBox2.Name = "groupBox2";
|
||||||
|
groupBox2.Size = new Size(198, 172);
|
||||||
|
groupBox2.TabIndex = 13;
|
||||||
|
groupBox2.TabStop = false;
|
||||||
|
groupBox2.Text = "线参数";
|
||||||
|
//
|
||||||
|
// NumRectWidth1
|
||||||
|
//
|
||||||
|
NumRectWidth1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
NumRectWidth1.Location = new Point(56, 138);
|
||||||
|
NumRectWidth1.Maximum = new decimal(new int[] { 9000, 0, 0, 0 });
|
||||||
|
NumRectWidth1.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
|
NumRectWidth1.Name = "NumRectWidth1";
|
||||||
|
NumRectWidth1.Size = new Size(136, 23);
|
||||||
|
NumRectWidth1.TabIndex = 13;
|
||||||
|
NumRectWidth1.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// label11
|
||||||
|
//
|
||||||
|
label11.AutoSize = true;
|
||||||
|
label11.Location = new Point(6, 140);
|
||||||
|
label11.Name = "label11";
|
||||||
|
label11.Size = new Size(35, 17);
|
||||||
|
label11.TabIndex = 12;
|
||||||
|
label11.Text = "宽度:";
|
||||||
|
//
|
||||||
|
// tbLineX2
|
||||||
|
//
|
||||||
|
tbLineX2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLineX2.Location = new Point(56, 80);
|
||||||
|
tbLineX2.Name = "tbLineX2";
|
||||||
|
tbLineX2.Size = new Size(136, 23);
|
||||||
|
tbLineX2.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// label8
|
||||||
|
//
|
||||||
|
label8.AutoSize = true;
|
||||||
|
label8.Location = new Point(6, 83);
|
||||||
|
label8.Name = "label8";
|
||||||
|
label8.Size = new Size(26, 17);
|
||||||
|
label8.TabIndex = 8;
|
||||||
|
label8.Text = "X2:";
|
||||||
|
//
|
||||||
|
// tbLineY2
|
||||||
|
//
|
||||||
|
tbLineY2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLineY2.Location = new Point(56, 109);
|
||||||
|
tbLineY2.Name = "tbLineY2";
|
||||||
|
tbLineY2.Size = new Size(136, 23);
|
||||||
|
tbLineY2.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
label5.AutoSize = true;
|
||||||
|
label5.Location = new Point(6, 112);
|
||||||
|
label5.Name = "label5";
|
||||||
|
label5.Size = new Size(25, 17);
|
||||||
|
label5.TabIndex = 6;
|
||||||
|
label5.Text = "Y2:";
|
||||||
|
//
|
||||||
|
// tbLineX1
|
||||||
|
//
|
||||||
|
tbLineX1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLineX1.Location = new Point(56, 22);
|
||||||
|
tbLineX1.Name = "tbLineX1";
|
||||||
|
tbLineX1.Size = new Size(136, 23);
|
||||||
|
tbLineX1.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// tbLineY1
|
||||||
|
//
|
||||||
|
tbLineY1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLineY1.Location = new Point(56, 51);
|
||||||
|
tbLineY1.Name = "tbLineY1";
|
||||||
|
tbLineY1.Size = new Size(136, 23);
|
||||||
|
tbLineY1.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// label6
|
||||||
|
//
|
||||||
|
label6.AutoSize = true;
|
||||||
|
label6.Location = new Point(6, 54);
|
||||||
|
label6.Name = "label6";
|
||||||
|
label6.Size = new Size(25, 17);
|
||||||
|
label6.TabIndex = 1;
|
||||||
|
label6.Text = "Y1:";
|
||||||
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
label7.AutoSize = true;
|
||||||
|
label7.Location = new Point(6, 25);
|
||||||
|
label7.Name = "label7";
|
||||||
|
label7.Size = new Size(26, 17);
|
||||||
|
label7.TabIndex = 0;
|
||||||
|
label7.Text = "X1:";
|
||||||
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
groupBox1.Controls.Add(tbCircleX);
|
||||||
|
groupBox1.Controls.Add(tbCircleY);
|
||||||
|
groupBox1.Controls.Add(tbCircleR);
|
||||||
|
groupBox1.Controls.Add(label3);
|
||||||
|
groupBox1.Controls.Add(label2);
|
||||||
|
groupBox1.Controls.Add(label1);
|
||||||
|
groupBox1.Dock = DockStyle.Top;
|
||||||
|
groupBox1.Location = new Point(0, 36);
|
||||||
|
groupBox1.Name = "groupBox1";
|
||||||
|
groupBox1.Size = new Size(198, 116);
|
||||||
|
groupBox1.TabIndex = 12;
|
||||||
|
groupBox1.TabStop = false;
|
||||||
|
groupBox1.Text = "圆参数";
|
||||||
|
//
|
||||||
|
// tbCircleX
|
||||||
|
//
|
||||||
|
tbCircleX.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbCircleX.Location = new Point(56, 22);
|
||||||
|
tbCircleX.Name = "tbCircleX";
|
||||||
|
tbCircleX.Size = new Size(136, 23);
|
||||||
|
tbCircleX.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// tbCircleY
|
||||||
|
//
|
||||||
|
tbCircleY.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbCircleY.Location = new Point(56, 51);
|
||||||
|
tbCircleY.Name = "tbCircleY";
|
||||||
|
tbCircleY.Size = new Size(136, 23);
|
||||||
|
tbCircleY.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// tbCircleR
|
||||||
|
//
|
||||||
|
tbCircleR.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbCircleR.Location = new Point(56, 80);
|
||||||
|
tbCircleR.Name = "tbCircleR";
|
||||||
|
tbCircleR.Size = new Size(136, 23);
|
||||||
|
tbCircleR.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Location = new Point(3, 83);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(44, 17);
|
||||||
|
label3.TabIndex = 2;
|
||||||
|
label3.Text = "半径:";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(6, 54);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(18, 17);
|
||||||
|
label2.TabIndex = 1;
|
||||||
|
label2.Text = "Y:";
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(6, 25);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(19, 17);
|
||||||
|
label1.TabIndex = 0;
|
||||||
|
label1.Text = "X:";
|
||||||
|
//
|
||||||
|
// ctrlTitleBar
|
||||||
|
//
|
||||||
|
ctrlTitleBar.Dock = DockStyle.Top;
|
||||||
|
ctrlTitleBar.Location = new Point(0, 0);
|
||||||
|
ctrlTitleBar.MinimumSize = new Size(0, 36);
|
||||||
|
ctrlTitleBar.Name = "ctrlTitleBar";
|
||||||
|
ctrlTitleBar.Padding = new Padding(3);
|
||||||
|
ctrlTitleBar.Size = new Size(198, 36);
|
||||||
|
ctrlTitleBar.TabIndex = 11;
|
||||||
|
ctrlTitleBar.Title = "线圆测量";
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
panel1.Controls.Add(canvas);
|
||||||
|
panel1.Controls.Add(statusStrip1);
|
||||||
|
panel1.Dock = DockStyle.Fill;
|
||||||
|
panel1.Location = new Point(0, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(1076, 640);
|
||||||
|
panel1.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// canvas
|
||||||
|
//
|
||||||
|
canvas.AllowMultiSelect = false;
|
||||||
|
canvas.CreateMode = Canvas.Shape.ShapeTypeEnum.Polygon;
|
||||||
|
canvas.Dock = DockStyle.Fill;
|
||||||
|
canvas.Enabled = false;
|
||||||
|
canvas.FillDrawing = false;
|
||||||
|
canvas.Location = new Point(0, 0);
|
||||||
|
canvas.Margin = new Padding(2);
|
||||||
|
canvas.Name = "canvas";
|
||||||
|
canvas.OutsideShapes = (List<Canvas.Shape.FlyShape>)resources.GetObject("canvas.OutsideShapes");
|
||||||
|
canvas.Scale = 1F;
|
||||||
|
canvas.Shapes = (List<Canvas.Shape.FlyShape>)resources.GetObject("canvas.Shapes");
|
||||||
|
canvas.Size = new Size(1074, 616);
|
||||||
|
canvas.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// statusStrip1
|
||||||
|
//
|
||||||
|
statusStrip1.Items.AddRange(new ToolStripItem[] { lblStatus });
|
||||||
|
statusStrip1.Location = new Point(0, 616);
|
||||||
|
statusStrip1.Name = "statusStrip1";
|
||||||
|
statusStrip1.Size = new Size(1074, 22);
|
||||||
|
statusStrip1.TabIndex = 1;
|
||||||
|
statusStrip1.Text = "statusStrip1";
|
||||||
|
//
|
||||||
|
// lblStatus
|
||||||
|
//
|
||||||
|
lblStatus.Name = "lblStatus";
|
||||||
|
lblStatus.Size = new Size(44, 17);
|
||||||
|
lblStatus.Text = " ";
|
||||||
|
//
|
||||||
|
// btnSave
|
||||||
|
//
|
||||||
|
btnSave.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnSave.Location = new Point(6, 545);
|
||||||
|
btnSave.Name = "btnSave";
|
||||||
|
btnSave.Size = new Size(186, 32);
|
||||||
|
btnSave.TabIndex = 30;
|
||||||
|
btnSave.Text = "保存数据";
|
||||||
|
btnSave.UseVisualStyleBackColor = true;
|
||||||
|
btnSave.Click += btnSave_Click;
|
||||||
|
//
|
||||||
|
// GuideLineCircleCtrl
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(splitContainer);
|
||||||
|
Controls.Add(lblElapsed);
|
||||||
|
Controls.Add(label4);
|
||||||
|
Name = "GuideLineCircleCtrl";
|
||||||
|
Size = new Size(1280, 640);
|
||||||
|
Load += GuideLineCircleCtrl_Load;
|
||||||
|
splitContainer.Panel1.ResumeLayout(false);
|
||||||
|
splitContainer.Panel2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)splitContainer).EndInit();
|
||||||
|
splitContainer.ResumeLayout(false);
|
||||||
|
panelGuide.ResumeLayout(false);
|
||||||
|
panelGuide.PerformLayout();
|
||||||
|
groupBox2.ResumeLayout(false);
|
||||||
|
groupBox2.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)NumRectWidth1).EndInit();
|
||||||
|
groupBox1.ResumeLayout(false);
|
||||||
|
groupBox1.PerformLayout();
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
panel1.PerformLayout();
|
||||||
|
statusStrip1.ResumeLayout(false);
|
||||||
|
statusStrip1.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label lblElapsed;
|
||||||
|
private Label label4;
|
||||||
|
|
||||||
|
private SplitContainer splitContainer;
|
||||||
|
private Panel panelGuide;
|
||||||
|
private Panel panel1;
|
||||||
|
private Canvas.UI.FlyCanvas canvas;
|
||||||
|
private StatusStrip statusStrip1;
|
||||||
|
private ToolStripStatusLabel lblStatus;
|
||||||
|
private GroupBox groupBox2;
|
||||||
|
private TextBox tbLineX2;
|
||||||
|
private Label label8;
|
||||||
|
private TextBox tbLineY2;
|
||||||
|
private Label label5;
|
||||||
|
private TextBox tbLineX1;
|
||||||
|
private TextBox tbLineY1;
|
||||||
|
private Label label6;
|
||||||
|
private Label label7;
|
||||||
|
private GroupBox groupBox1;
|
||||||
|
private TextBox tbCircleX;
|
||||||
|
private TextBox tbCircleY;
|
||||||
|
private TextBox tbCircleR;
|
||||||
|
private Label label3;
|
||||||
|
private Label label2;
|
||||||
|
private Label label1;
|
||||||
|
private SizeCtrlTitleBar ctrlTitleBar;
|
||||||
|
private Button btnCreateCircle;
|
||||||
|
private Button btnLoadImage;
|
||||||
|
private Label label9;
|
||||||
|
private Button btnExecute;
|
||||||
|
private Label label10;
|
||||||
|
private Button btnCreateLine;
|
||||||
|
private TextBox tbRectWidth1;
|
||||||
|
private Label label11;
|
||||||
|
private NumericUpDown NumRectWidth1;
|
||||||
|
private Label lblDistance;
|
||||||
|
private Label label17;
|
||||||
|
private Label lblResult;
|
||||||
|
private Label label15;
|
||||||
|
private Button btnSave;
|
||||||
|
}
|
||||||
|
}
|
449
CanFly/UI/SizePanel/SizeGuideLineCircleCtrl.cs
Normal file
449
CanFly/UI/SizePanel/SizeGuideLineCircleCtrl.cs
Normal file
@@ -0,0 +1,449 @@
|
|||||||
|
using CanFly.Canvas.Helper;
|
||||||
|
using CanFly.Canvas.Shape;
|
||||||
|
using CanFly.Canvas.UI;
|
||||||
|
using CanFly.Helper;
|
||||||
|
using HalconDotNet;
|
||||||
|
using OpenCvSharp;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
namespace CanFly.UI.SizePanel
|
||||||
|
{
|
||||||
|
public partial class SizeGuideLineCircleCtrl : SizeBaseGuideControl
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
private FlyShape? _circle;
|
||||||
|
private FlyShape? _line;
|
||||||
|
|
||||||
|
|
||||||
|
private float _lineX1;
|
||||||
|
private float _lineY1;
|
||||||
|
private float _lineX2;
|
||||||
|
private float _lineY2;
|
||||||
|
private float _lineWidth;
|
||||||
|
|
||||||
|
|
||||||
|
private float _circleX;
|
||||||
|
private float _circleY;
|
||||||
|
private float _circleR;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected override string GetScriptFileName() => "LineToCircle.hdvp";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public SizeGuideLineCircleCtrl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.canvas.mouseMoved += Canvas_mouseMoved;
|
||||||
|
this.canvas.OnShapeUpdateEvent += UpdateShape;
|
||||||
|
this.canvas.selectionChanged += Canvas_selectionChanged;
|
||||||
|
|
||||||
|
this.canvas.OnShapeMoving += Canvas_OnShapeMoving;
|
||||||
|
this.canvas.newShape += Canvas_newShape;
|
||||||
|
|
||||||
|
this.ctrlTitleBar.OnCloseClicked += OnControlClose;
|
||||||
|
|
||||||
|
NumRectWidth1.ValueChanged -= NumRectWidth1_ValueChanged;
|
||||||
|
NumRectWidth1.Value = 40;
|
||||||
|
NumRectWidth1.ValueChanged += NumRectWidth1_ValueChanged;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected override void UpdateShape(FlyShape shape)
|
||||||
|
{
|
||||||
|
switch (shape.ShapeType)
|
||||||
|
{
|
||||||
|
case ShapeTypeEnum.Line:
|
||||||
|
this._line = shape;
|
||||||
|
_line.IsDrawLineVirtualRect = true;
|
||||||
|
var pts = this._line.Points;
|
||||||
|
|
||||||
|
_lineX1 = pts[0].X;
|
||||||
|
_lineY1 = pts[0].Y;
|
||||||
|
_lineX2 = pts[1].X;
|
||||||
|
_lineY2 = pts[1].Y;
|
||||||
|
_lineWidth = shape.LineVirtualRectWidth;
|
||||||
|
|
||||||
|
tbLineX1.Text = _lineX1.ToString("F3");
|
||||||
|
tbLineY1.Text = _lineY1.ToString("F3");
|
||||||
|
tbLineX2.Text = _lineX2.ToString("F3");
|
||||||
|
tbLineY2.Text = _lineY2.ToString("F3");
|
||||||
|
// NumRectWidth1.Value = (decimal)_lineWidth;
|
||||||
|
break;
|
||||||
|
case ShapeTypeEnum.Circle:
|
||||||
|
this._circle = shape;
|
||||||
|
|
||||||
|
_circleX = shape.Points[0].X;
|
||||||
|
_circleY = shape.Points[0].Y;
|
||||||
|
_circleR = PointHelper.Distance(shape.Points[0], shape.Points[1]);
|
||||||
|
|
||||||
|
this.tbCircleX.Text = _circleX.ToString("F3");
|
||||||
|
this.tbCircleY.Text = _circleY.ToString("F3");
|
||||||
|
this.tbCircleR.Text = _circleR.ToString("F3");
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void GuideLineCircleCtrl_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_mouseMoved(PointF pos)
|
||||||
|
{
|
||||||
|
if (InvokeRequired)
|
||||||
|
{
|
||||||
|
Invoke(Canvas_mouseMoved, pos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lblStatus.Text = $"X:{pos.X}, Y:{pos.Y}";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_selectionChanged(List<FlyShape> shapes)
|
||||||
|
{
|
||||||
|
//if (shapes.Count != 1)
|
||||||
|
//{
|
||||||
|
// // panelGuide.Controls.Clear();
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
//SwitchGuideForm(shapes[0].ShapeType);
|
||||||
|
// Canvas_OnShapeUpdateEvent(shapes[0]);
|
||||||
|
|
||||||
|
if (shapes.Count != 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UpdateShape(shapes[0]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_OnShapeMoving(List<FlyShape> shapes)
|
||||||
|
{
|
||||||
|
if (shapes.Count != 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateShape(shapes[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void btnCreateCircle_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (this.canvas.pixmap == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先打开图片");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.tbCircleX.Text = string.Empty;
|
||||||
|
this.tbCircleY.Text = string.Empty;
|
||||||
|
this.tbCircleR.Text = string.Empty;
|
||||||
|
this.canvas.Shapes.RemoveAll(shp => shp.ShapeType == ShapeTypeEnum.Circle);
|
||||||
|
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
this.canvas.StartDraw(ShapeTypeEnum.Circle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void btnCreateLine_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (this.canvas.pixmap == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先打开图片");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tbLineX1.Text = string.Empty;
|
||||||
|
tbLineY1.Text = string.Empty;
|
||||||
|
tbLineX2.Text = string.Empty;
|
||||||
|
tbLineY2.Text = string.Empty;
|
||||||
|
|
||||||
|
this.canvas.Shapes.RemoveAll(shp => shp.ShapeType == ShapeTypeEnum.Line);
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
this.canvas.StartDraw(ShapeTypeEnum.Line);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void btnLoadImage_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OpenImageFile(bitmap =>
|
||||||
|
{
|
||||||
|
this.canvas.LoadPixmap(bitmap);
|
||||||
|
this.canvas.Enabled = true;
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_newShape()
|
||||||
|
{
|
||||||
|
this.canvas.StopDraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
string strarrayX=string.Empty;
|
||||||
|
string strarrayY=string.Empty;
|
||||||
|
private void btnExecute_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (this.canvas.pixmap == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先打开图片");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.tbLineX1.Text.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先创建直线");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.tbLineX1.Text.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先创建圆形");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.canvas.OutsideShapes.Clear();
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
|
||||||
|
flag = new List<double>();
|
||||||
|
Distance = new List<double>();
|
||||||
|
fRowCenter = new List<double>();
|
||||||
|
fColCenter = new List<double>();
|
||||||
|
fRadius = new List<double>();
|
||||||
|
RowBegin = new List<double>();
|
||||||
|
ColBegin = new List<double>();
|
||||||
|
RowEnd = new List<double>();
|
||||||
|
ColEnd = new List<double>();
|
||||||
|
Dictionary<string, HObject> inputImg = new Dictionary<string, HObject>();
|
||||||
|
|
||||||
|
if (hImage == null)
|
||||||
|
{
|
||||||
|
HOperatorSet.ReadImage(out hImage, CurrentImageFile);
|
||||||
|
}
|
||||||
|
inputImg["INPUT_Image"] = hImage;
|
||||||
|
|
||||||
|
Dictionary<string, HTuple> inputPara = new Dictionary<string, HTuple>();
|
||||||
|
|
||||||
|
PointF[] Points = this._line.LineVirtualRectPoints;
|
||||||
|
PointF Point1 = Points[0];
|
||||||
|
PointF Point2 = Points[1];
|
||||||
|
PointF Point3 = Points[2];
|
||||||
|
PointF Point4 = Points[3];
|
||||||
|
PointF Point5 = Points[0];
|
||||||
|
|
||||||
|
float x1 = Point1.X;
|
||||||
|
float y1 = Point1.Y;
|
||||||
|
|
||||||
|
float x2 = Point2.X;
|
||||||
|
float y2 = Point2.Y;
|
||||||
|
|
||||||
|
float x3 = Point3.X;
|
||||||
|
float y3 = Point3.Y;
|
||||||
|
|
||||||
|
float x4 = Point4.X;
|
||||||
|
float y4 = Point4.Y;
|
||||||
|
|
||||||
|
float x5 = Point5.X;
|
||||||
|
float y5 = Point5.Y;
|
||||||
|
|
||||||
|
|
||||||
|
float[] arrayX = new float[] { x1, x2, x3, x4, x5 };
|
||||||
|
HTuple hTupleArrayX = new HTuple(arrayX);
|
||||||
|
|
||||||
|
float[] arrayY = new float[] { y1, y2, y3, y4, y5 };
|
||||||
|
HTuple hTupleArrayY = new HTuple(arrayY);
|
||||||
|
|
||||||
|
strarrayX=string.Join(",", arrayX);
|
||||||
|
strarrayY=string.Join(",", arrayY);
|
||||||
|
|
||||||
|
inputPara["LX"] = _lineX1;
|
||||||
|
inputPara["LY"] = _lineY1;
|
||||||
|
inputPara["RX"] = _lineX2;
|
||||||
|
inputPara["RY"] = _lineY2;
|
||||||
|
inputPara["XCenter"] = _circleX;
|
||||||
|
inputPara["YCenter"] = _circleY;
|
||||||
|
inputPara["Radius"] = _circleR;
|
||||||
|
inputPara["Line_XRect"] = hTupleArrayX;
|
||||||
|
inputPara["Line_YRect"] = hTupleArrayY;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<string> outputKeys = new List<string>()
|
||||||
|
{
|
||||||
|
"OUTPUT_Flag",
|
||||||
|
"distance",
|
||||||
|
"fRowCenter",
|
||||||
|
"fColCenter",
|
||||||
|
"fRadius",
|
||||||
|
"RowBegin",
|
||||||
|
"ColBegin",
|
||||||
|
"RowEnd",
|
||||||
|
"ColEnd"
|
||||||
|
};
|
||||||
|
|
||||||
|
ExecuteHScript(
|
||||||
|
inputImg,
|
||||||
|
inputPara,
|
||||||
|
outputKeys);
|
||||||
|
|
||||||
|
}
|
||||||
|
List<double> flag = new List<double>();
|
||||||
|
List<double> Distance = new List<double>();
|
||||||
|
List<double> fRowCenter = new List<double>();
|
||||||
|
List<double> fColCenter = new List<double>();
|
||||||
|
List<double> fRadius = new List<double>();
|
||||||
|
List<double> RowBegin = new List<double>();
|
||||||
|
List<double> ColBegin = new List<double>();
|
||||||
|
List<double> RowEnd = new List<double>();
|
||||||
|
List<double> ColEnd = new List<double>();
|
||||||
|
protected override void OnExecuteHScriptResult(
|
||||||
|
bool success,
|
||||||
|
Dictionary<string, HTuple> resultDic,
|
||||||
|
int timeElasped)
|
||||||
|
{
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//"OUTPUT_Flag",
|
||||||
|
// "distance",
|
||||||
|
// "fRowCenter",
|
||||||
|
// "fColCenter",
|
||||||
|
// "fRadius",
|
||||||
|
// "RowBegin",
|
||||||
|
// "ColBegin",
|
||||||
|
// "RowEnd",
|
||||||
|
// "ColEnd"
|
||||||
|
|
||||||
|
flag = resultDic["OUTPUT_Flag"].HTupleToDouble();
|
||||||
|
Distance = resultDic["distance"].HTupleToDouble();
|
||||||
|
fRowCenter = resultDic["fRowCenter"].HTupleToDouble();
|
||||||
|
fColCenter = resultDic["fColCenter"].HTupleToDouble();
|
||||||
|
fRadius = resultDic["fRadius"].HTupleToDouble();
|
||||||
|
RowBegin = resultDic["RowBegin"].HTupleToDouble();
|
||||||
|
ColBegin = resultDic["ColBegin"].HTupleToDouble();
|
||||||
|
RowEnd = resultDic["RowEnd"].HTupleToDouble();
|
||||||
|
ColEnd = resultDic["ColEnd"].HTupleToDouble();
|
||||||
|
|
||||||
|
|
||||||
|
if (flag.Count > 0)
|
||||||
|
{
|
||||||
|
lblResult.Text = flag[0].ToString();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblResult.Text = "无";
|
||||||
|
}
|
||||||
|
if (Distance.Count > 0)
|
||||||
|
{
|
||||||
|
lblDistance.Text = Distance[0].ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblDistance.Text = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag.Count > 0 && Distance.Count > 0 && fRowCenter.Count > 0 && fColCenter.Count > 0 && fRadius.Count > 0 && RowBegin.Count > 0 && ColBegin.Count > 0 && RowEnd.Count > 0 && ColEnd.Count > 0)
|
||||||
|
{
|
||||||
|
float width = 0;
|
||||||
|
this.canvas.DrawLine(new PointF((float)ColBegin[0], (float)RowBegin[0]), new PointF((float)ColEnd[0], (float)RowEnd[0]), width);
|
||||||
|
this.canvas.DrawCircle(new PointF((float)fColCenter[0], (float)fRowCenter[0]), (float)fRadius[0]);
|
||||||
|
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
lblElapsed.Text = $"{timeElasped} ms";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void NumRectWidth1_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_line != null)
|
||||||
|
{
|
||||||
|
//_line1.IsDrawLineVirtualRect = true;
|
||||||
|
_line.LineVirtualRectWidth = (float)NumRectWidth1.Value;
|
||||||
|
UpdateShape(_line);
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (lblResult.Text.Equals("无"))
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先进行绘制");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (lblResult.Text != "0")
|
||||||
|
{
|
||||||
|
MessageBox.Show("测量计算错误,无法保存");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
string input = $"LX:{_lineX1};" +
|
||||||
|
$"LY:{_lineY1};" +
|
||||||
|
$"RX:{_lineX2};" +
|
||||||
|
$"RY:{_lineY2};" +
|
||||||
|
$"XCenter:{_circleX};" +
|
||||||
|
$"YCenter:{_circleY};" +
|
||||||
|
$"Radius:{_circleR};" +
|
||||||
|
$"Line_XRect:{strarrayX};"+
|
||||||
|
$"Line_YRect:{strarrayY}";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
string result = $"distance:{Distance[0]};";
|
||||||
|
DataToTriggerEvent(input, result);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
145
CanFly/UI/SizePanel/SizeGuideLineCircleCtrl.resx
Normal file
145
CanFly/UI/SizePanel/SizeGuideLineCircleCtrl.resx
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
<?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>
|
||||||
|
<data name="canvas.OutsideShapes" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>
|
||||||
|
AAEAAAD/////AQAAAAAAAAAMAgAAAERDYW5GbHkuQ2FudmFzLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1
|
||||||
|
cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAQBAAAAdlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5l
|
||||||
|
cmljLkxpc3RgMVtbQ2FuRmx5LkNhbnZhcy5TaGFwZS5GbHlTaGFwZSwgQ2FuRmx5LkNhbnZhcywgQ3Vs
|
||||||
|
dHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsXV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lv
|
||||||
|
bgQAAB5DYW5GbHkuQ2FudmFzLlNoYXBlLkZseVNoYXBlW10CAAAACAgJAwAAAAAAAAAAAAAADAQAAAAz
|
||||||
|
Q2FuRmx5LkNhbnZhcywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBwMAAAAAAQAA
|
||||||
|
AAAAAAAEHENhbkZseS5DYW52YXMuU2hhcGUuRmx5U2hhcGUEAAAACw==
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<data name="canvas.Shapes" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>
|
||||||
|
AAEAAAD/////AQAAAAAAAAAMAgAAAERDYW5GbHkuQ2FudmFzLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1
|
||||||
|
cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAQBAAAAdlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5l
|
||||||
|
cmljLkxpc3RgMVtbQ2FuRmx5LkNhbnZhcy5TaGFwZS5GbHlTaGFwZSwgQ2FuRmx5LkNhbnZhcywgQ3Vs
|
||||||
|
dHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsXV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lv
|
||||||
|
bgQAAB5DYW5GbHkuQ2FudmFzLlNoYXBlLkZseVNoYXBlW10CAAAACAgJAwAAAAAAAAAAAAAADAQAAAAz
|
||||||
|
Q2FuRmx5LkNhbnZhcywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBwMAAAAAAQAA
|
||||||
|
AAAAAAAEHENhbkZseS5DYW52YXMuU2hhcGUuRmx5U2hhcGUEAAAACw==
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
427
CanFly/UI/SizePanel/SizeGuideLineCtrl.Designer.cs
generated
Normal file
427
CanFly/UI/SizePanel/SizeGuideLineCtrl.Designer.cs
generated
Normal file
@@ -0,0 +1,427 @@
|
|||||||
|
namespace CanFly.UI.SizePanel
|
||||||
|
{
|
||||||
|
partial class SizeGuideLineCtrl
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SizeGuideLineCtrl));
|
||||||
|
lblElapsed = new Label();
|
||||||
|
label4 = new Label();
|
||||||
|
splitContainer = new SplitContainer();
|
||||||
|
panelGuide = new Panel();
|
||||||
|
btnSave = new Button();
|
||||||
|
lblResult = new Label();
|
||||||
|
label1 = new Label();
|
||||||
|
btnCreateLine = new Button();
|
||||||
|
btnLoadImage = new Button();
|
||||||
|
label9 = new Label();
|
||||||
|
btnExecute = new Button();
|
||||||
|
label10 = new Label();
|
||||||
|
groupBox2 = new GroupBox();
|
||||||
|
NumRectWidth1 = new NumericUpDown();
|
||||||
|
label11 = new Label();
|
||||||
|
tbLineX2 = new TextBox();
|
||||||
|
label8 = new Label();
|
||||||
|
tbLineY2 = new TextBox();
|
||||||
|
label5 = new Label();
|
||||||
|
tbLineX1 = new TextBox();
|
||||||
|
tbLineY1 = new TextBox();
|
||||||
|
label6 = new Label();
|
||||||
|
label7 = new Label();
|
||||||
|
ctrlTitleBar = new SizeCtrlTitleBar();
|
||||||
|
panel1 = new Panel();
|
||||||
|
canvas = new Canvas.UI.FlyCanvas();
|
||||||
|
statusStrip1 = new StatusStrip();
|
||||||
|
lblStatus = new ToolStripStatusLabel();
|
||||||
|
((System.ComponentModel.ISupportInitialize)splitContainer).BeginInit();
|
||||||
|
splitContainer.Panel1.SuspendLayout();
|
||||||
|
splitContainer.Panel2.SuspendLayout();
|
||||||
|
splitContainer.SuspendLayout();
|
||||||
|
panelGuide.SuspendLayout();
|
||||||
|
groupBox2.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)NumRectWidth1).BeginInit();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
statusStrip1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// lblElapsed
|
||||||
|
//
|
||||||
|
lblElapsed.AutoSize = true;
|
||||||
|
lblElapsed.Location = new Point(50, 328);
|
||||||
|
lblElapsed.Name = "lblElapsed";
|
||||||
|
lblElapsed.Size = new Size(32, 17);
|
||||||
|
lblElapsed.TabIndex = 9;
|
||||||
|
lblElapsed.Text = "0ms";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.Location = new Point(0, 328);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new Size(44, 17);
|
||||||
|
label4.TabIndex = 8;
|
||||||
|
label4.Text = "耗时:";
|
||||||
|
//
|
||||||
|
// splitContainer
|
||||||
|
//
|
||||||
|
splitContainer.Dock = DockStyle.Fill;
|
||||||
|
splitContainer.Location = new Point(0, 0);
|
||||||
|
splitContainer.Name = "splitContainer";
|
||||||
|
//
|
||||||
|
// splitContainer.Panel1
|
||||||
|
//
|
||||||
|
splitContainer.Panel1.Controls.Add(panelGuide);
|
||||||
|
splitContainer.Panel1MinSize = 150;
|
||||||
|
//
|
||||||
|
// splitContainer.Panel2
|
||||||
|
//
|
||||||
|
splitContainer.Panel2.Controls.Add(panel1);
|
||||||
|
splitContainer.Size = new Size(1280, 640);
|
||||||
|
splitContainer.SplitterDistance = 200;
|
||||||
|
splitContainer.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// panelGuide
|
||||||
|
//
|
||||||
|
panelGuide.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
panelGuide.Controls.Add(btnSave);
|
||||||
|
panelGuide.Controls.Add(lblResult);
|
||||||
|
panelGuide.Controls.Add(label1);
|
||||||
|
panelGuide.Controls.Add(btnCreateLine);
|
||||||
|
panelGuide.Controls.Add(btnLoadImage);
|
||||||
|
panelGuide.Controls.Add(label9);
|
||||||
|
panelGuide.Controls.Add(btnExecute);
|
||||||
|
panelGuide.Controls.Add(label10);
|
||||||
|
panelGuide.Controls.Add(groupBox2);
|
||||||
|
panelGuide.Controls.Add(ctrlTitleBar);
|
||||||
|
panelGuide.Dock = DockStyle.Fill;
|
||||||
|
panelGuide.Location = new Point(0, 0);
|
||||||
|
panelGuide.Name = "panelGuide";
|
||||||
|
panelGuide.Size = new Size(200, 640);
|
||||||
|
panelGuide.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// btnSave
|
||||||
|
//
|
||||||
|
btnSave.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnSave.Location = new Point(6, 390);
|
||||||
|
btnSave.Name = "btnSave";
|
||||||
|
btnSave.Size = new Size(186, 32);
|
||||||
|
btnSave.TabIndex = 23;
|
||||||
|
btnSave.Text = "保存数据";
|
||||||
|
btnSave.UseVisualStyleBackColor = true;
|
||||||
|
btnSave.Click += btnSave_Click;
|
||||||
|
//
|
||||||
|
// lblResult
|
||||||
|
//
|
||||||
|
lblResult.AutoSize = true;
|
||||||
|
lblResult.Location = new Point(59, 354);
|
||||||
|
lblResult.Name = "lblResult";
|
||||||
|
lblResult.Size = new Size(20, 17);
|
||||||
|
lblResult.TabIndex = 22;
|
||||||
|
lblResult.Text = "无";
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(9, 354);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(44, 17);
|
||||||
|
label1.TabIndex = 21;
|
||||||
|
label1.Text = "结果:";
|
||||||
|
//
|
||||||
|
// btnCreateLine
|
||||||
|
//
|
||||||
|
btnCreateLine.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnCreateLine.Location = new Point(9, 252);
|
||||||
|
btnCreateLine.Name = "btnCreateLine";
|
||||||
|
btnCreateLine.Size = new Size(186, 32);
|
||||||
|
btnCreateLine.TabIndex = 20;
|
||||||
|
btnCreateLine.Text = "创建直线";
|
||||||
|
btnCreateLine.UseVisualStyleBackColor = true;
|
||||||
|
btnCreateLine.Click += btnCreateLine_Click;
|
||||||
|
//
|
||||||
|
// btnLoadImage
|
||||||
|
//
|
||||||
|
btnLoadImage.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnLoadImage.Location = new Point(6, 214);
|
||||||
|
btnLoadImage.Name = "btnLoadImage";
|
||||||
|
btnLoadImage.Size = new Size(186, 32);
|
||||||
|
btnLoadImage.TabIndex = 18;
|
||||||
|
btnLoadImage.Text = "打开图片";
|
||||||
|
btnLoadImage.UseVisualStyleBackColor = true;
|
||||||
|
btnLoadImage.Click += btnLoadImage_Click;
|
||||||
|
//
|
||||||
|
// label9
|
||||||
|
//
|
||||||
|
label9.AutoSize = true;
|
||||||
|
label9.Location = new Point(59, 325);
|
||||||
|
label9.Name = "label9";
|
||||||
|
label9.Size = new Size(32, 17);
|
||||||
|
label9.TabIndex = 17;
|
||||||
|
label9.Text = "0ms";
|
||||||
|
//
|
||||||
|
// btnExecute
|
||||||
|
//
|
||||||
|
btnExecute.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnExecute.Location = new Point(9, 290);
|
||||||
|
btnExecute.Name = "btnExecute";
|
||||||
|
btnExecute.Size = new Size(186, 32);
|
||||||
|
btnExecute.TabIndex = 15;
|
||||||
|
btnExecute.Text = "执行";
|
||||||
|
btnExecute.UseVisualStyleBackColor = true;
|
||||||
|
btnExecute.Click += btnExecute_Click;
|
||||||
|
//
|
||||||
|
// label10
|
||||||
|
//
|
||||||
|
label10.AutoSize = true;
|
||||||
|
label10.Location = new Point(9, 325);
|
||||||
|
label10.Name = "label10";
|
||||||
|
label10.Size = new Size(44, 17);
|
||||||
|
label10.TabIndex = 16;
|
||||||
|
label10.Text = "耗时:";
|
||||||
|
//
|
||||||
|
// groupBox2
|
||||||
|
//
|
||||||
|
groupBox2.Controls.Add(NumRectWidth1);
|
||||||
|
groupBox2.Controls.Add(label11);
|
||||||
|
groupBox2.Controls.Add(tbLineX2);
|
||||||
|
groupBox2.Controls.Add(label8);
|
||||||
|
groupBox2.Controls.Add(tbLineY2);
|
||||||
|
groupBox2.Controls.Add(label5);
|
||||||
|
groupBox2.Controls.Add(tbLineX1);
|
||||||
|
groupBox2.Controls.Add(tbLineY1);
|
||||||
|
groupBox2.Controls.Add(label6);
|
||||||
|
groupBox2.Controls.Add(label7);
|
||||||
|
groupBox2.Dock = DockStyle.Top;
|
||||||
|
groupBox2.Location = new Point(0, 36);
|
||||||
|
groupBox2.Name = "groupBox2";
|
||||||
|
groupBox2.Size = new Size(198, 172);
|
||||||
|
groupBox2.TabIndex = 13;
|
||||||
|
groupBox2.TabStop = false;
|
||||||
|
groupBox2.Text = "线参数";
|
||||||
|
//
|
||||||
|
// NumRectWidth1
|
||||||
|
//
|
||||||
|
NumRectWidth1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
NumRectWidth1.Location = new Point(56, 138);
|
||||||
|
NumRectWidth1.Maximum = new decimal(new int[] { 9000, 0, 0, 0 });
|
||||||
|
NumRectWidth1.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
|
NumRectWidth1.Name = "NumRectWidth1";
|
||||||
|
NumRectWidth1.Size = new Size(136, 23);
|
||||||
|
NumRectWidth1.TabIndex = 13;
|
||||||
|
NumRectWidth1.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// label11
|
||||||
|
//
|
||||||
|
label11.AutoSize = true;
|
||||||
|
label11.Location = new Point(6, 140);
|
||||||
|
label11.Name = "label11";
|
||||||
|
label11.Size = new Size(35, 17);
|
||||||
|
label11.TabIndex = 12;
|
||||||
|
label11.Text = "宽度:";
|
||||||
|
//
|
||||||
|
// tbLineX2
|
||||||
|
//
|
||||||
|
tbLineX2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLineX2.Location = new Point(56, 80);
|
||||||
|
tbLineX2.Name = "tbLineX2";
|
||||||
|
tbLineX2.Size = new Size(136, 23);
|
||||||
|
tbLineX2.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// label8
|
||||||
|
//
|
||||||
|
label8.AutoSize = true;
|
||||||
|
label8.Location = new Point(6, 83);
|
||||||
|
label8.Name = "label8";
|
||||||
|
label8.Size = new Size(26, 17);
|
||||||
|
label8.TabIndex = 8;
|
||||||
|
label8.Text = "X2:";
|
||||||
|
//
|
||||||
|
// tbLineY2
|
||||||
|
//
|
||||||
|
tbLineY2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLineY2.Location = new Point(56, 109);
|
||||||
|
tbLineY2.Name = "tbLineY2";
|
||||||
|
tbLineY2.Size = new Size(136, 23);
|
||||||
|
tbLineY2.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
label5.AutoSize = true;
|
||||||
|
label5.Location = new Point(6, 112);
|
||||||
|
label5.Name = "label5";
|
||||||
|
label5.Size = new Size(25, 17);
|
||||||
|
label5.TabIndex = 6;
|
||||||
|
label5.Text = "Y2:";
|
||||||
|
//
|
||||||
|
// tbLineX1
|
||||||
|
//
|
||||||
|
tbLineX1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLineX1.Location = new Point(56, 22);
|
||||||
|
tbLineX1.Name = "tbLineX1";
|
||||||
|
tbLineX1.Size = new Size(136, 23);
|
||||||
|
tbLineX1.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// tbLineY1
|
||||||
|
//
|
||||||
|
tbLineY1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLineY1.Location = new Point(56, 51);
|
||||||
|
tbLineY1.Name = "tbLineY1";
|
||||||
|
tbLineY1.Size = new Size(136, 23);
|
||||||
|
tbLineY1.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// label6
|
||||||
|
//
|
||||||
|
label6.AutoSize = true;
|
||||||
|
label6.Location = new Point(6, 54);
|
||||||
|
label6.Name = "label6";
|
||||||
|
label6.Size = new Size(25, 17);
|
||||||
|
label6.TabIndex = 1;
|
||||||
|
label6.Text = "Y1:";
|
||||||
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
label7.AutoSize = true;
|
||||||
|
label7.Location = new Point(6, 25);
|
||||||
|
label7.Name = "label7";
|
||||||
|
label7.Size = new Size(26, 17);
|
||||||
|
label7.TabIndex = 0;
|
||||||
|
label7.Text = "X1:";
|
||||||
|
//
|
||||||
|
// ctrlTitleBar
|
||||||
|
//
|
||||||
|
ctrlTitleBar.Dock = DockStyle.Top;
|
||||||
|
ctrlTitleBar.Location = new Point(0, 0);
|
||||||
|
ctrlTitleBar.MinimumSize = new Size(0, 36);
|
||||||
|
ctrlTitleBar.Name = "ctrlTitleBar";
|
||||||
|
ctrlTitleBar.Padding = new Padding(3);
|
||||||
|
ctrlTitleBar.Size = new Size(198, 36);
|
||||||
|
ctrlTitleBar.TabIndex = 11;
|
||||||
|
ctrlTitleBar.Title = "直线测量";
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
panel1.Controls.Add(canvas);
|
||||||
|
panel1.Controls.Add(statusStrip1);
|
||||||
|
panel1.Dock = DockStyle.Fill;
|
||||||
|
panel1.Location = new Point(0, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(1076, 640);
|
||||||
|
panel1.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// canvas
|
||||||
|
//
|
||||||
|
canvas.AllowMultiSelect = false;
|
||||||
|
canvas.CreateMode = Canvas.Shape.ShapeTypeEnum.Polygon;
|
||||||
|
canvas.Dock = DockStyle.Fill;
|
||||||
|
canvas.Enabled = false;
|
||||||
|
canvas.FillDrawing = false;
|
||||||
|
canvas.Location = new Point(0, 0);
|
||||||
|
canvas.Margin = new Padding(2);
|
||||||
|
canvas.Name = "canvas";
|
||||||
|
canvas.OutsideShapes = (List<Canvas.Shape.FlyShape>)resources.GetObject("canvas.OutsideShapes");
|
||||||
|
canvas.Scale = 1F;
|
||||||
|
canvas.Shapes = (List<Canvas.Shape.FlyShape>)resources.GetObject("canvas.Shapes");
|
||||||
|
canvas.Size = new Size(1074, 616);
|
||||||
|
canvas.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// statusStrip1
|
||||||
|
//
|
||||||
|
statusStrip1.Items.AddRange(new ToolStripItem[] { lblStatus });
|
||||||
|
statusStrip1.Location = new Point(0, 616);
|
||||||
|
statusStrip1.Name = "statusStrip1";
|
||||||
|
statusStrip1.Size = new Size(1074, 22);
|
||||||
|
statusStrip1.TabIndex = 1;
|
||||||
|
statusStrip1.Text = "statusStrip1";
|
||||||
|
//
|
||||||
|
// lblStatus
|
||||||
|
//
|
||||||
|
lblStatus.Name = "lblStatus";
|
||||||
|
lblStatus.Size = new Size(44, 17);
|
||||||
|
lblStatus.Text = " ";
|
||||||
|
//
|
||||||
|
// GuideLineCtrl
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(splitContainer);
|
||||||
|
Controls.Add(lblElapsed);
|
||||||
|
Controls.Add(label4);
|
||||||
|
Name = "GuideLineCtrl";
|
||||||
|
Size = new Size(1280, 640);
|
||||||
|
Load += GuideLineCircleCtrl_Load;
|
||||||
|
splitContainer.Panel1.ResumeLayout(false);
|
||||||
|
splitContainer.Panel2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)splitContainer).EndInit();
|
||||||
|
splitContainer.ResumeLayout(false);
|
||||||
|
panelGuide.ResumeLayout(false);
|
||||||
|
panelGuide.PerformLayout();
|
||||||
|
groupBox2.ResumeLayout(false);
|
||||||
|
groupBox2.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)NumRectWidth1).EndInit();
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
panel1.PerformLayout();
|
||||||
|
statusStrip1.ResumeLayout(false);
|
||||||
|
statusStrip1.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label lblElapsed;
|
||||||
|
private Label label4;
|
||||||
|
|
||||||
|
private SplitContainer splitContainer;
|
||||||
|
private Panel panelGuide;
|
||||||
|
private Panel panel1;
|
||||||
|
private Canvas.UI.FlyCanvas canvas;
|
||||||
|
private StatusStrip statusStrip1;
|
||||||
|
private ToolStripStatusLabel lblStatus;
|
||||||
|
private GroupBox groupBox2;
|
||||||
|
private TextBox tbLineX2;
|
||||||
|
private Label label8;
|
||||||
|
private TextBox tbLineY2;
|
||||||
|
private Label label5;
|
||||||
|
private TextBox tbLineX1;
|
||||||
|
private TextBox tbLineY1;
|
||||||
|
private Label label6;
|
||||||
|
private Label label7;
|
||||||
|
private SizeCtrlTitleBar ctrlTitleBar;
|
||||||
|
private Button btnLoadImage;
|
||||||
|
private Label label9;
|
||||||
|
private Button btnExecute;
|
||||||
|
private Label label10;
|
||||||
|
private Button btnCreateLine;
|
||||||
|
private TextBox tbRectWidth1;
|
||||||
|
private Label label11;
|
||||||
|
private NumericUpDown NumRectWidth1;
|
||||||
|
private Label lblResult;
|
||||||
|
private Label label1;
|
||||||
|
private Button btnSave;
|
||||||
|
}
|
||||||
|
}
|
387
CanFly/UI/SizePanel/SizeGuideLineCtrl.cs
Normal file
387
CanFly/UI/SizePanel/SizeGuideLineCtrl.cs
Normal file
@@ -0,0 +1,387 @@
|
|||||||
|
using CanFly.Canvas.Helper;
|
||||||
|
using CanFly.Canvas.Shape;
|
||||||
|
using CanFly.Canvas.UI;
|
||||||
|
using CanFly.Helper;
|
||||||
|
using HalconDotNet;
|
||||||
|
using OpenCvSharp;
|
||||||
|
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;
|
||||||
|
|
||||||
|
namespace CanFly.UI.SizePanel
|
||||||
|
{
|
||||||
|
public partial class SizeGuideLineCtrl : SizeBaseGuideControl
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private FlyShape? _line;
|
||||||
|
|
||||||
|
|
||||||
|
private float _lineX1;
|
||||||
|
private float _lineY1;
|
||||||
|
private float _lineX2;
|
||||||
|
private float _lineY2;
|
||||||
|
private float _lineWidth;
|
||||||
|
private PointF[] _rectPoints = new PointF[4];
|
||||||
|
//private float _LineLX=new float();
|
||||||
|
//private float _LineLY =new float();
|
||||||
|
//private float _LineRX =new float();
|
||||||
|
//private float _LineRY =new float();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected override string GetScriptFileName() => "Line_detect.hdvp";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public SizeGuideLineCtrl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
this.canvas.mouseMoved += Canvas_mouseMoved;
|
||||||
|
this.canvas.OnShapeUpdateEvent += UpdateShape;
|
||||||
|
this.canvas.selectionChanged += Canvas_selectionChanged;
|
||||||
|
|
||||||
|
this.canvas.OnShapeMoving += Canvas_OnShapeMoving;
|
||||||
|
this.canvas.newShape += Canvas_newShape;
|
||||||
|
|
||||||
|
this.ctrlTitleBar.OnCloseClicked += OnControlClose;
|
||||||
|
|
||||||
|
NumRectWidth1.ValueChanged -= NumRectWidth1_ValueChanged;
|
||||||
|
NumRectWidth1.Value = 40;
|
||||||
|
NumRectWidth1.ValueChanged += NumRectWidth1_ValueChanged;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected override void UpdateShape(FlyShape shape)
|
||||||
|
{
|
||||||
|
switch (shape.ShapeType)
|
||||||
|
{
|
||||||
|
case ShapeTypeEnum.Line:
|
||||||
|
this._line = shape;
|
||||||
|
_line.IsDrawLineVirtualRect = true;
|
||||||
|
var pts = this._line.Points;
|
||||||
|
|
||||||
|
_lineX1 = pts[0].X;
|
||||||
|
_lineY1 = pts[0].Y;
|
||||||
|
_lineX2 = pts[1].X;
|
||||||
|
_lineY2 = pts[1].Y;
|
||||||
|
_lineWidth = shape.LineVirtualRectWidth;
|
||||||
|
_rectPoints = shape.LineVirtualRectPoints;
|
||||||
|
//_LineLX = (shape.LineVirtualRectPoints[0].X + shape.LineVirtualRectPoints[3].X) / 2;
|
||||||
|
//_LineLY = (shape.LineVirtualRectPoints[0].Y + shape.LineVirtualRectPoints[3].Y) / 2;
|
||||||
|
//_LineRX = (shape.LineVirtualRectPoints[1].X + shape.LineVirtualRectPoints[2].X) / 2;
|
||||||
|
//_LineRY = (shape.LineVirtualRectPoints[1].Y + shape.LineVirtualRectPoints[2].Y) / 2;
|
||||||
|
|
||||||
|
tbLineX1.Text = _lineX1.ToString("F3");
|
||||||
|
tbLineY1.Text = _lineY1.ToString("F3");
|
||||||
|
tbLineX2.Text = _lineX2.ToString("F3");
|
||||||
|
tbLineY2.Text = _lineY2.ToString("F3");
|
||||||
|
// NumRectWidth1.Value = (decimal)_lineWidth;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void GuideLineCircleCtrl_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_mouseMoved(PointF pos)
|
||||||
|
{
|
||||||
|
if (InvokeRequired)
|
||||||
|
{
|
||||||
|
Invoke(Canvas_mouseMoved, pos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lblStatus.Text = $"X:{pos.X}, Y:{pos.Y}";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_selectionChanged(List<FlyShape> shapes)
|
||||||
|
{
|
||||||
|
//if (shapes.Count != 1)
|
||||||
|
//{
|
||||||
|
// // panelGuide.Controls.Clear();
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
//SwitchGuideForm(shapes[0].ShapeType);
|
||||||
|
// Canvas_OnShapeUpdateEvent(shapes[0]);
|
||||||
|
|
||||||
|
if (shapes.Count != 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UpdateShape(shapes[0]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_OnShapeMoving(List<FlyShape> shapes)
|
||||||
|
{
|
||||||
|
if (shapes.Count != 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateShape(shapes[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void btnCreateLine_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (this.canvas.pixmap == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先打开图片");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbLineX1.Text = string.Empty;
|
||||||
|
tbLineY1.Text = string.Empty;
|
||||||
|
tbLineX2.Text = string.Empty;
|
||||||
|
tbLineY2.Text = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
this.canvas.Shapes.RemoveAll(shp => shp.ShapeType == ShapeTypeEnum.Line);
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
this.canvas.StartDraw(ShapeTypeEnum.Line);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void btnLoadImage_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OpenImageFile(bitmap =>
|
||||||
|
{
|
||||||
|
this.canvas.LoadPixmap(bitmap);
|
||||||
|
this.canvas.Enabled = true;
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_newShape()
|
||||||
|
{
|
||||||
|
this.canvas.StopDraw();
|
||||||
|
}
|
||||||
|
string strarrayX = string.Empty;
|
||||||
|
string strarrayY = string.Empty;
|
||||||
|
private void btnExecute_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (this.canvas.pixmap == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先打开图片");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.tbLineX1.Text.Trim().Length == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先创建直线");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.canvas.OutsideShapes.Clear();
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
|
||||||
|
|
||||||
|
flag = new List<double>();
|
||||||
|
RowBegin = new List<double>();
|
||||||
|
ColBegin = new List<double>();
|
||||||
|
RowEnd = new List<double>();
|
||||||
|
ColEnd = new List<double>();
|
||||||
|
Dictionary<string, HObject> inputImg = new Dictionary<string, HObject>();
|
||||||
|
|
||||||
|
if (hImage == null)
|
||||||
|
{
|
||||||
|
HOperatorSet.ReadImage(out hImage, CurrentImageFile);
|
||||||
|
}
|
||||||
|
inputImg["INPUT_Image"] = hImage;
|
||||||
|
// 创建一维数组
|
||||||
|
|
||||||
|
Dictionary<string, HTuple> inputPara = new Dictionary<string, HTuple>();
|
||||||
|
|
||||||
|
// 获取矩形的 4 个点
|
||||||
|
PointF[] Points = this._line.LineVirtualRectPoints;
|
||||||
|
PointF Point1 = Points[0];
|
||||||
|
PointF Point2 = Points[1];
|
||||||
|
PointF Point3 = Points[2];
|
||||||
|
PointF Point4 = Points[3];
|
||||||
|
PointF Point5 = Points[0];
|
||||||
|
|
||||||
|
float x1 = Point1.X;
|
||||||
|
float y1 = Point1.Y;
|
||||||
|
|
||||||
|
float x2 = Point2.X;
|
||||||
|
float y2 = Point2.Y;
|
||||||
|
|
||||||
|
float x3 = Point3.X;
|
||||||
|
float y3 = Point3.Y;
|
||||||
|
|
||||||
|
float x4 = Point4.X;
|
||||||
|
float y4 = Point4.Y;
|
||||||
|
|
||||||
|
float x5 = Point5.X;
|
||||||
|
float y5 = Point5.Y;
|
||||||
|
|
||||||
|
|
||||||
|
float[] arrayX = new float[] { x1, x2, x3, x4, x5 };
|
||||||
|
HTuple hTupleArrayX = new HTuple(arrayX);
|
||||||
|
|
||||||
|
float[] arrayY = new float[] { y1, y2, y3, y4, y5 };
|
||||||
|
HTuple hTupleArrayY = new HTuple(arrayY);
|
||||||
|
|
||||||
|
strarrayX = string.Join(",", arrayX);
|
||||||
|
strarrayY = string.Join(",", arrayY);
|
||||||
|
|
||||||
|
inputPara["LX"] = _lineX1;
|
||||||
|
inputPara["LY"] = _lineY1;
|
||||||
|
inputPara["RX"] = _lineX2;
|
||||||
|
inputPara["RY"] = _lineY2;
|
||||||
|
inputPara["XRect"] = hTupleArrayX;
|
||||||
|
inputPara["YRect"] = hTupleArrayY;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<string> outputKeys = new List<string>()
|
||||||
|
{
|
||||||
|
"OUTPUT_Flag",
|
||||||
|
"RowBegin",
|
||||||
|
"ColBegin",
|
||||||
|
"RowEnd",
|
||||||
|
"ColEnd"
|
||||||
|
};
|
||||||
|
|
||||||
|
ExecuteHScript(
|
||||||
|
inputImg,
|
||||||
|
inputPara,
|
||||||
|
outputKeys);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<double> flag = new List<double>();
|
||||||
|
List<double> RowBegin = new List<double>();
|
||||||
|
List<double> ColBegin = new List<double>();
|
||||||
|
List<double> RowEnd = new List<double>();
|
||||||
|
List<double> ColEnd = new List<double>();
|
||||||
|
|
||||||
|
|
||||||
|
protected override void OnExecuteHScriptResult(
|
||||||
|
bool success,
|
||||||
|
Dictionary<string, HTuple> resultDic,
|
||||||
|
int timeElasped)
|
||||||
|
{
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
"OUTPUT_Flag",
|
||||||
|
"RXCenter",
|
||||||
|
"RYCenter",
|
||||||
|
"RRadius"
|
||||||
|
*/
|
||||||
|
|
||||||
|
flag = resultDic["OUTPUT_Flag"].HTupleToDouble();
|
||||||
|
RowBegin = resultDic["RowBegin"].HTupleToDouble();
|
||||||
|
ColBegin = resultDic["ColBegin"].HTupleToDouble();
|
||||||
|
RowEnd = resultDic["RowEnd"].HTupleToDouble();
|
||||||
|
ColEnd = resultDic["ColEnd"].HTupleToDouble();
|
||||||
|
if (flag.Count > 0)
|
||||||
|
{
|
||||||
|
lblResult.Text = flag[0].ToString();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblResult.Text = "无";
|
||||||
|
}
|
||||||
|
if (flag.Count > 0 && RowBegin.Count > 0 && ColBegin.Count > 0 && RowEnd.Count > 0 && ColEnd.Count > 0)
|
||||||
|
{
|
||||||
|
float width = 0;
|
||||||
|
this.canvas.DrawLine(new PointF((float)ColBegin[0], (float)RowBegin[0]), new PointF((float)ColEnd[0], (float)RowEnd[0]), width);
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
lblElapsed.Text = $"{timeElasped} ms";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void NumRectWidth1_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_line != null)
|
||||||
|
{
|
||||||
|
//_line1.IsDrawLineVirtualRect = true;
|
||||||
|
_line.LineVirtualRectWidth = (float)NumRectWidth1.Value;
|
||||||
|
UpdateShape(_line);
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (lblResult.Text.Equals("无"))
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先进行绘制");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (lblResult.Text != "0")
|
||||||
|
{
|
||||||
|
MessageBox.Show("测量计算错误,无法保存");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//flag = resultDic["OUTPUT_Flag"].HTupleToDouble();
|
||||||
|
//RowBegin = resultDic["RowBegin"].HTupleToDouble();
|
||||||
|
//ColBegin = resultDic["ColBegin"].HTupleToDouble();
|
||||||
|
//RowEnd = resultDic["RowEnd"].HTupleToDouble();
|
||||||
|
//ColEnd = resultDic["ColEnd"].HTupleToDouble();
|
||||||
|
|
||||||
|
|
||||||
|
string input = $"LX:{_lineX1};" +
|
||||||
|
$"LY:{_lineY1};" +
|
||||||
|
$"RX:{_lineX2};" +
|
||||||
|
$"RY:{_lineY2};" +
|
||||||
|
$"Line_XRect:{strarrayX};" +
|
||||||
|
$"Line_YRect:{strarrayY}";
|
||||||
|
|
||||||
|
|
||||||
|
string result = $"RowBegin:{string.Join(";", RowBegin[0])};ColBegin:{string.Join(";", ColBegin[0])};RowEnd:{string.Join(";", RowEnd[0])};ColEnd:{string.Join(";", ColEnd[0])}";
|
||||||
|
|
||||||
|
DataToTriggerEvent(input, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
145
CanFly/UI/SizePanel/SizeGuideLineCtrl.resx
Normal file
145
CanFly/UI/SizePanel/SizeGuideLineCtrl.resx
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
<?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>
|
||||||
|
<data name="canvas.OutsideShapes" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>
|
||||||
|
AAEAAAD/////AQAAAAAAAAAMAgAAAERDYW5GbHkuQ2FudmFzLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1
|
||||||
|
cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAQBAAAAdlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5l
|
||||||
|
cmljLkxpc3RgMVtbQ2FuRmx5LkNhbnZhcy5TaGFwZS5GbHlTaGFwZSwgQ2FuRmx5LkNhbnZhcywgQ3Vs
|
||||||
|
dHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsXV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lv
|
||||||
|
bgQAAB5DYW5GbHkuQ2FudmFzLlNoYXBlLkZseVNoYXBlW10CAAAACAgJAwAAAAAAAAAAAAAADAQAAAAz
|
||||||
|
Q2FuRmx5LkNhbnZhcywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBwMAAAAAAQAA
|
||||||
|
AAAAAAAEHENhbkZseS5DYW52YXMuU2hhcGUuRmx5U2hhcGUEAAAACw==
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<data name="canvas.Shapes" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>
|
||||||
|
AAEAAAD/////AQAAAAAAAAAMAgAAAERDYW5GbHkuQ2FudmFzLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1
|
||||||
|
cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAQBAAAAdlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5l
|
||||||
|
cmljLkxpc3RgMVtbQ2FuRmx5LkNhbnZhcy5TaGFwZS5GbHlTaGFwZSwgQ2FuRmx5LkNhbnZhcywgQ3Vs
|
||||||
|
dHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsXV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lv
|
||||||
|
bgQAAB5DYW5GbHkuQ2FudmFzLlNoYXBlLkZseVNoYXBlW10CAAAACAgJAwAAAAAAAAAAAAAADAQAAAAz
|
||||||
|
Q2FuRmx5LkNhbnZhcywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBwMAAAAAAQAA
|
||||||
|
AAAAAAAEHENhbkZseS5DYW52YXMuU2hhcGUuRmx5U2hhcGUEAAAACw==
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
570
CanFly/UI/SizePanel/SizeGuideLineLineCtrl.Designer.cs
generated
Normal file
570
CanFly/UI/SizePanel/SizeGuideLineLineCtrl.Designer.cs
generated
Normal file
@@ -0,0 +1,570 @@
|
|||||||
|
namespace CanFly.UI.SizePanel
|
||||||
|
{
|
||||||
|
partial class SizeGuideLineLineCtrl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SizeGuideLineLineCtrl));
|
||||||
|
lblStatus = new ToolStripStatusLabel();
|
||||||
|
panel1 = new Panel();
|
||||||
|
canvas = new Canvas.UI.FlyCanvas();
|
||||||
|
statusStrip1 = new StatusStrip();
|
||||||
|
ctrlTitleBar = new SizeCtrlTitleBar();
|
||||||
|
tbLine1X2 = new TextBox();
|
||||||
|
label8 = new Label();
|
||||||
|
tbLine1Y2 = new TextBox();
|
||||||
|
label5 = new Label();
|
||||||
|
label10 = new Label();
|
||||||
|
tbLine1X1 = new TextBox();
|
||||||
|
tbLine1Y1 = new TextBox();
|
||||||
|
label6 = new Label();
|
||||||
|
label7 = new Label();
|
||||||
|
btnLoadImage = new Button();
|
||||||
|
label9 = new Label();
|
||||||
|
btnExecute = new Button();
|
||||||
|
panelGuide = new Panel();
|
||||||
|
lblDistance = new Label();
|
||||||
|
label17 = new Label();
|
||||||
|
lblResult = new Label();
|
||||||
|
label15 = new Label();
|
||||||
|
groupBox3 = new GroupBox();
|
||||||
|
NumRectWidth2 = new NumericUpDown();
|
||||||
|
label2 = new Label();
|
||||||
|
tbLine2X2 = new TextBox();
|
||||||
|
label11 = new Label();
|
||||||
|
tbLine2Y2 = new TextBox();
|
||||||
|
label12 = new Label();
|
||||||
|
tbLine2X1 = new TextBox();
|
||||||
|
tbLine2Y1 = new TextBox();
|
||||||
|
label13 = new Label();
|
||||||
|
label14 = new Label();
|
||||||
|
groupBox2 = new GroupBox();
|
||||||
|
NumRectWidth1 = new NumericUpDown();
|
||||||
|
label1 = new Label();
|
||||||
|
splitContainer = new SplitContainer();
|
||||||
|
lblElapsed = new Label();
|
||||||
|
label4 = new Label();
|
||||||
|
btnSave = new Button();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
statusStrip1.SuspendLayout();
|
||||||
|
panelGuide.SuspendLayout();
|
||||||
|
groupBox3.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)NumRectWidth2).BeginInit();
|
||||||
|
groupBox2.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)NumRectWidth1).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)splitContainer).BeginInit();
|
||||||
|
splitContainer.Panel1.SuspendLayout();
|
||||||
|
splitContainer.Panel2.SuspendLayout();
|
||||||
|
splitContainer.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// lblStatus
|
||||||
|
//
|
||||||
|
lblStatus.Name = "lblStatus";
|
||||||
|
lblStatus.Size = new Size(44, 17);
|
||||||
|
lblStatus.Text = " ";
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
panel1.Controls.Add(canvas);
|
||||||
|
panel1.Controls.Add(statusStrip1);
|
||||||
|
panel1.Dock = DockStyle.Fill;
|
||||||
|
panel1.Location = new Point(0, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(1076, 640);
|
||||||
|
panel1.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// canvas
|
||||||
|
//
|
||||||
|
canvas.AllowMultiSelect = false;
|
||||||
|
canvas.CreateMode = Canvas.Shape.ShapeTypeEnum.Polygon;
|
||||||
|
canvas.Dock = DockStyle.Fill;
|
||||||
|
canvas.Enabled = false;
|
||||||
|
canvas.FillDrawing = false;
|
||||||
|
canvas.Location = new Point(0, 0);
|
||||||
|
canvas.Margin = new Padding(2);
|
||||||
|
canvas.Name = "canvas";
|
||||||
|
canvas.OutsideShapes = (List<Canvas.Shape.FlyShape>)resources.GetObject("canvas.OutsideShapes");
|
||||||
|
canvas.Scale = 1F;
|
||||||
|
canvas.Shapes = (List<Canvas.Shape.FlyShape>)resources.GetObject("canvas.Shapes");
|
||||||
|
canvas.Size = new Size(1074, 616);
|
||||||
|
canvas.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// statusStrip1
|
||||||
|
//
|
||||||
|
statusStrip1.Items.AddRange(new ToolStripItem[] { lblStatus });
|
||||||
|
statusStrip1.Location = new Point(0, 616);
|
||||||
|
statusStrip1.Name = "statusStrip1";
|
||||||
|
statusStrip1.Size = new Size(1074, 22);
|
||||||
|
statusStrip1.TabIndex = 1;
|
||||||
|
statusStrip1.Text = "statusStrip1";
|
||||||
|
//
|
||||||
|
// ctrlTitleBar
|
||||||
|
//
|
||||||
|
ctrlTitleBar.Dock = DockStyle.Top;
|
||||||
|
ctrlTitleBar.Location = new Point(0, 0);
|
||||||
|
ctrlTitleBar.MinimumSize = new Size(0, 36);
|
||||||
|
ctrlTitleBar.Name = "ctrlTitleBar";
|
||||||
|
ctrlTitleBar.Padding = new Padding(3);
|
||||||
|
ctrlTitleBar.Size = new Size(198, 36);
|
||||||
|
ctrlTitleBar.TabIndex = 11;
|
||||||
|
ctrlTitleBar.Title = "线线测量";
|
||||||
|
//
|
||||||
|
// tbLine1X2
|
||||||
|
//
|
||||||
|
tbLine1X2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLine1X2.Location = new Point(56, 80);
|
||||||
|
tbLine1X2.Name = "tbLine1X2";
|
||||||
|
tbLine1X2.Size = new Size(134, 23);
|
||||||
|
tbLine1X2.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// label8
|
||||||
|
//
|
||||||
|
label8.AutoSize = true;
|
||||||
|
label8.Location = new Point(6, 83);
|
||||||
|
label8.Name = "label8";
|
||||||
|
label8.Size = new Size(26, 17);
|
||||||
|
label8.TabIndex = 8;
|
||||||
|
label8.Text = "X2:";
|
||||||
|
//
|
||||||
|
// tbLine1Y2
|
||||||
|
//
|
||||||
|
tbLine1Y2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLine1Y2.Location = new Point(56, 109);
|
||||||
|
tbLine1Y2.Name = "tbLine1Y2";
|
||||||
|
tbLine1Y2.Size = new Size(134, 23);
|
||||||
|
tbLine1Y2.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
label5.AutoSize = true;
|
||||||
|
label5.Location = new Point(6, 112);
|
||||||
|
label5.Name = "label5";
|
||||||
|
label5.Size = new Size(25, 17);
|
||||||
|
label5.TabIndex = 6;
|
||||||
|
label5.Text = "Y2:";
|
||||||
|
//
|
||||||
|
// label10
|
||||||
|
//
|
||||||
|
label10.AutoSize = true;
|
||||||
|
label10.Location = new Point(6, 521);
|
||||||
|
label10.Name = "label10";
|
||||||
|
label10.Size = new Size(44, 17);
|
||||||
|
label10.TabIndex = 16;
|
||||||
|
label10.Text = "耗时:";
|
||||||
|
//
|
||||||
|
// tbLine1X1
|
||||||
|
//
|
||||||
|
tbLine1X1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLine1X1.Location = new Point(56, 22);
|
||||||
|
tbLine1X1.Name = "tbLine1X1";
|
||||||
|
tbLine1X1.Size = new Size(134, 23);
|
||||||
|
tbLine1X1.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// tbLine1Y1
|
||||||
|
//
|
||||||
|
tbLine1Y1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLine1Y1.Location = new Point(56, 51);
|
||||||
|
tbLine1Y1.Name = "tbLine1Y1";
|
||||||
|
tbLine1Y1.Size = new Size(134, 23);
|
||||||
|
tbLine1Y1.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// label6
|
||||||
|
//
|
||||||
|
label6.AutoSize = true;
|
||||||
|
label6.Location = new Point(6, 54);
|
||||||
|
label6.Name = "label6";
|
||||||
|
label6.Size = new Size(25, 17);
|
||||||
|
label6.TabIndex = 1;
|
||||||
|
label6.Text = "Y1:";
|
||||||
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
label7.AutoSize = true;
|
||||||
|
label7.Location = new Point(6, 25);
|
||||||
|
label7.Name = "label7";
|
||||||
|
label7.Size = new Size(26, 17);
|
||||||
|
label7.TabIndex = 0;
|
||||||
|
label7.Text = "X1:";
|
||||||
|
//
|
||||||
|
// btnLoadImage
|
||||||
|
//
|
||||||
|
btnLoadImage.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnLoadImage.Location = new Point(6, 394);
|
||||||
|
btnLoadImage.Name = "btnLoadImage";
|
||||||
|
btnLoadImage.Size = new Size(184, 32);
|
||||||
|
btnLoadImage.TabIndex = 18;
|
||||||
|
btnLoadImage.Text = "打开图片";
|
||||||
|
btnLoadImage.UseVisualStyleBackColor = true;
|
||||||
|
btnLoadImage.Click += btnLoadImage_Click;
|
||||||
|
//
|
||||||
|
// label9
|
||||||
|
//
|
||||||
|
label9.AutoSize = true;
|
||||||
|
label9.Location = new Point(54, 521);
|
||||||
|
label9.Name = "label9";
|
||||||
|
label9.Size = new Size(32, 17);
|
||||||
|
label9.TabIndex = 17;
|
||||||
|
label9.Text = "0ms";
|
||||||
|
//
|
||||||
|
// btnExecute
|
||||||
|
//
|
||||||
|
btnExecute.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnExecute.Location = new Point(5, 432);
|
||||||
|
btnExecute.Name = "btnExecute";
|
||||||
|
btnExecute.Size = new Size(184, 32);
|
||||||
|
btnExecute.TabIndex = 15;
|
||||||
|
btnExecute.Text = "执行";
|
||||||
|
btnExecute.UseVisualStyleBackColor = true;
|
||||||
|
btnExecute.Click += btnExecute_Click;
|
||||||
|
//
|
||||||
|
// panelGuide
|
||||||
|
//
|
||||||
|
panelGuide.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
panelGuide.Controls.Add(btnSave);
|
||||||
|
panelGuide.Controls.Add(lblDistance);
|
||||||
|
panelGuide.Controls.Add(label17);
|
||||||
|
panelGuide.Controls.Add(lblResult);
|
||||||
|
panelGuide.Controls.Add(label15);
|
||||||
|
panelGuide.Controls.Add(groupBox3);
|
||||||
|
panelGuide.Controls.Add(btnLoadImage);
|
||||||
|
panelGuide.Controls.Add(label9);
|
||||||
|
panelGuide.Controls.Add(btnExecute);
|
||||||
|
panelGuide.Controls.Add(label10);
|
||||||
|
panelGuide.Controls.Add(groupBox2);
|
||||||
|
panelGuide.Controls.Add(ctrlTitleBar);
|
||||||
|
panelGuide.Dock = DockStyle.Fill;
|
||||||
|
panelGuide.Location = new Point(0, 0);
|
||||||
|
panelGuide.Name = "panelGuide";
|
||||||
|
panelGuide.Size = new Size(200, 640);
|
||||||
|
panelGuide.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// lblDistance
|
||||||
|
//
|
||||||
|
lblDistance.AutoSize = true;
|
||||||
|
lblDistance.Location = new Point(54, 493);
|
||||||
|
lblDistance.Name = "lblDistance";
|
||||||
|
lblDistance.Size = new Size(15, 17);
|
||||||
|
lblDistance.TabIndex = 25;
|
||||||
|
lblDistance.Text = "0";
|
||||||
|
//
|
||||||
|
// label17
|
||||||
|
//
|
||||||
|
label17.AutoSize = true;
|
||||||
|
label17.Location = new Point(6, 493);
|
||||||
|
label17.Name = "label17";
|
||||||
|
label17.Size = new Size(44, 17);
|
||||||
|
label17.TabIndex = 24;
|
||||||
|
label17.Text = "距离:";
|
||||||
|
//
|
||||||
|
// lblResult
|
||||||
|
//
|
||||||
|
lblResult.AutoSize = true;
|
||||||
|
lblResult.Location = new Point(54, 467);
|
||||||
|
lblResult.Name = "lblResult";
|
||||||
|
lblResult.Size = new Size(20, 17);
|
||||||
|
lblResult.TabIndex = 23;
|
||||||
|
lblResult.Text = "无";
|
||||||
|
//
|
||||||
|
// label15
|
||||||
|
//
|
||||||
|
label15.AutoSize = true;
|
||||||
|
label15.Location = new Point(6, 467);
|
||||||
|
label15.Name = "label15";
|
||||||
|
label15.Size = new Size(44, 17);
|
||||||
|
label15.TabIndex = 22;
|
||||||
|
label15.Text = "结果:";
|
||||||
|
//
|
||||||
|
// groupBox3
|
||||||
|
//
|
||||||
|
groupBox3.Controls.Add(NumRectWidth2);
|
||||||
|
groupBox3.Controls.Add(label2);
|
||||||
|
groupBox3.Controls.Add(tbLine2X2);
|
||||||
|
groupBox3.Controls.Add(label11);
|
||||||
|
groupBox3.Controls.Add(tbLine2Y2);
|
||||||
|
groupBox3.Controls.Add(label12);
|
||||||
|
groupBox3.Controls.Add(tbLine2X1);
|
||||||
|
groupBox3.Controls.Add(tbLine2Y1);
|
||||||
|
groupBox3.Controls.Add(label13);
|
||||||
|
groupBox3.Controls.Add(label14);
|
||||||
|
groupBox3.Dock = DockStyle.Top;
|
||||||
|
groupBox3.Location = new Point(0, 216);
|
||||||
|
groupBox3.Name = "groupBox3";
|
||||||
|
groupBox3.Size = new Size(198, 172);
|
||||||
|
groupBox3.TabIndex = 21;
|
||||||
|
groupBox3.TabStop = false;
|
||||||
|
groupBox3.Text = "线2参数";
|
||||||
|
//
|
||||||
|
// NumRectWidth2
|
||||||
|
//
|
||||||
|
NumRectWidth2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
NumRectWidth2.Location = new Point(53, 138);
|
||||||
|
NumRectWidth2.Maximum = new decimal(new int[] { 9000, 0, 0, 0 });
|
||||||
|
NumRectWidth2.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
|
NumRectWidth2.Name = "NumRectWidth2";
|
||||||
|
NumRectWidth2.Size = new Size(136, 23);
|
||||||
|
NumRectWidth2.TabIndex = 13;
|
||||||
|
NumRectWidth2.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(6, 140);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(35, 17);
|
||||||
|
label2.TabIndex = 12;
|
||||||
|
label2.Text = "宽度:";
|
||||||
|
//
|
||||||
|
// tbLine2X2
|
||||||
|
//
|
||||||
|
tbLine2X2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLine2X2.Location = new Point(56, 80);
|
||||||
|
tbLine2X2.Name = "tbLine2X2";
|
||||||
|
tbLine2X2.Size = new Size(134, 23);
|
||||||
|
tbLine2X2.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// label11
|
||||||
|
//
|
||||||
|
label11.AutoSize = true;
|
||||||
|
label11.Location = new Point(6, 83);
|
||||||
|
label11.Name = "label11";
|
||||||
|
label11.Size = new Size(26, 17);
|
||||||
|
label11.TabIndex = 8;
|
||||||
|
label11.Text = "X2:";
|
||||||
|
//
|
||||||
|
// tbLine2Y2
|
||||||
|
//
|
||||||
|
tbLine2Y2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLine2Y2.Location = new Point(56, 109);
|
||||||
|
tbLine2Y2.Name = "tbLine2Y2";
|
||||||
|
tbLine2Y2.Size = new Size(136, 23);
|
||||||
|
tbLine2Y2.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// label12
|
||||||
|
//
|
||||||
|
label12.AutoSize = true;
|
||||||
|
label12.Location = new Point(6, 112);
|
||||||
|
label12.Name = "label12";
|
||||||
|
label12.Size = new Size(25, 17);
|
||||||
|
label12.TabIndex = 6;
|
||||||
|
label12.Text = "Y2:";
|
||||||
|
//
|
||||||
|
// tbLine2X1
|
||||||
|
//
|
||||||
|
tbLine2X1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLine2X1.Location = new Point(56, 22);
|
||||||
|
tbLine2X1.Name = "tbLine2X1";
|
||||||
|
tbLine2X1.Size = new Size(134, 23);
|
||||||
|
tbLine2X1.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// tbLine2Y1
|
||||||
|
//
|
||||||
|
tbLine2Y1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
tbLine2Y1.Location = new Point(56, 51);
|
||||||
|
tbLine2Y1.Name = "tbLine2Y1";
|
||||||
|
tbLine2Y1.Size = new Size(134, 23);
|
||||||
|
tbLine2Y1.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// label13
|
||||||
|
//
|
||||||
|
label13.AutoSize = true;
|
||||||
|
label13.Location = new Point(6, 54);
|
||||||
|
label13.Name = "label13";
|
||||||
|
label13.Size = new Size(25, 17);
|
||||||
|
label13.TabIndex = 1;
|
||||||
|
label13.Text = "Y1:";
|
||||||
|
//
|
||||||
|
// label14
|
||||||
|
//
|
||||||
|
label14.AutoSize = true;
|
||||||
|
label14.Location = new Point(6, 25);
|
||||||
|
label14.Name = "label14";
|
||||||
|
label14.Size = new Size(26, 17);
|
||||||
|
label14.TabIndex = 0;
|
||||||
|
label14.Text = "X1:";
|
||||||
|
//
|
||||||
|
// groupBox2
|
||||||
|
//
|
||||||
|
groupBox2.Controls.Add(NumRectWidth1);
|
||||||
|
groupBox2.Controls.Add(label1);
|
||||||
|
groupBox2.Controls.Add(tbLine1X2);
|
||||||
|
groupBox2.Controls.Add(label8);
|
||||||
|
groupBox2.Controls.Add(tbLine1Y2);
|
||||||
|
groupBox2.Controls.Add(label5);
|
||||||
|
groupBox2.Controls.Add(tbLine1X1);
|
||||||
|
groupBox2.Controls.Add(tbLine1Y1);
|
||||||
|
groupBox2.Controls.Add(label6);
|
||||||
|
groupBox2.Controls.Add(label7);
|
||||||
|
groupBox2.Dock = DockStyle.Top;
|
||||||
|
groupBox2.Location = new Point(0, 36);
|
||||||
|
groupBox2.Name = "groupBox2";
|
||||||
|
groupBox2.Size = new Size(198, 180);
|
||||||
|
groupBox2.TabIndex = 13;
|
||||||
|
groupBox2.TabStop = false;
|
||||||
|
groupBox2.Text = "线1参数";
|
||||||
|
//
|
||||||
|
// NumRectWidth1
|
||||||
|
//
|
||||||
|
NumRectWidth1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
NumRectWidth1.Location = new Point(54, 138);
|
||||||
|
NumRectWidth1.Maximum = new decimal(new int[] { 9000, 0, 0, 0 });
|
||||||
|
NumRectWidth1.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
|
NumRectWidth1.Name = "NumRectWidth1";
|
||||||
|
NumRectWidth1.Size = new Size(135, 23);
|
||||||
|
NumRectWidth1.TabIndex = 11;
|
||||||
|
NumRectWidth1.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(6, 140);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(35, 17);
|
||||||
|
label1.TabIndex = 10;
|
||||||
|
label1.Text = "宽度:";
|
||||||
|
//
|
||||||
|
// splitContainer
|
||||||
|
//
|
||||||
|
splitContainer.Dock = DockStyle.Fill;
|
||||||
|
splitContainer.Location = new Point(0, 0);
|
||||||
|
splitContainer.Name = "splitContainer";
|
||||||
|
//
|
||||||
|
// splitContainer.Panel1
|
||||||
|
//
|
||||||
|
splitContainer.Panel1.Controls.Add(panelGuide);
|
||||||
|
splitContainer.Panel1MinSize = 150;
|
||||||
|
//
|
||||||
|
// splitContainer.Panel2
|
||||||
|
//
|
||||||
|
splitContainer.Panel2.Controls.Add(panel1);
|
||||||
|
splitContainer.Size = new Size(1280, 640);
|
||||||
|
splitContainer.SplitterDistance = 200;
|
||||||
|
splitContainer.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// lblElapsed
|
||||||
|
//
|
||||||
|
lblElapsed.AutoSize = true;
|
||||||
|
lblElapsed.Location = new Point(50, 328);
|
||||||
|
lblElapsed.Name = "lblElapsed";
|
||||||
|
lblElapsed.Size = new Size(32, 17);
|
||||||
|
lblElapsed.TabIndex = 13;
|
||||||
|
lblElapsed.Text = "0ms";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.Location = new Point(0, 328);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new Size(44, 17);
|
||||||
|
label4.TabIndex = 12;
|
||||||
|
label4.Text = "耗时:";
|
||||||
|
//
|
||||||
|
// btnSave
|
||||||
|
//
|
||||||
|
btnSave.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
btnSave.Location = new Point(3, 541);
|
||||||
|
btnSave.Name = "btnSave";
|
||||||
|
btnSave.Size = new Size(186, 32);
|
||||||
|
btnSave.TabIndex = 26;
|
||||||
|
btnSave.Text = "保存数据";
|
||||||
|
btnSave.UseVisualStyleBackColor = true;
|
||||||
|
btnSave.Click += btnSave_Click;
|
||||||
|
//
|
||||||
|
// GuideLineLineCtrl
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(splitContainer);
|
||||||
|
Controls.Add(lblElapsed);
|
||||||
|
Controls.Add(label4);
|
||||||
|
Name = "GuideLineLineCtrl";
|
||||||
|
Size = new Size(1280, 640);
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
panel1.PerformLayout();
|
||||||
|
statusStrip1.ResumeLayout(false);
|
||||||
|
statusStrip1.PerformLayout();
|
||||||
|
panelGuide.ResumeLayout(false);
|
||||||
|
panelGuide.PerformLayout();
|
||||||
|
groupBox3.ResumeLayout(false);
|
||||||
|
groupBox3.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)NumRectWidth2).EndInit();
|
||||||
|
groupBox2.ResumeLayout(false);
|
||||||
|
groupBox2.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)NumRectWidth1).EndInit();
|
||||||
|
splitContainer.Panel1.ResumeLayout(false);
|
||||||
|
splitContainer.Panel2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)splitContainer).EndInit();
|
||||||
|
splitContainer.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ToolStripStatusLabel lblStatus;
|
||||||
|
private Panel panel1;
|
||||||
|
private Canvas.UI.FlyCanvas canvas;
|
||||||
|
private StatusStrip statusStrip1;
|
||||||
|
private SizeCtrlTitleBar ctrlTitleBar;
|
||||||
|
private TextBox tbLine1X2;
|
||||||
|
private Label label8;
|
||||||
|
private TextBox tbLine1Y2;
|
||||||
|
private Label label5;
|
||||||
|
private Label label10;
|
||||||
|
private TextBox tbLine1X1;
|
||||||
|
private TextBox tbLine1Y1;
|
||||||
|
private Label label6;
|
||||||
|
private Label label7;
|
||||||
|
private Button btnLoadImage;
|
||||||
|
private Label label9;
|
||||||
|
private Button btnExecute;
|
||||||
|
private Panel panelGuide;
|
||||||
|
private GroupBox groupBox2;
|
||||||
|
private SplitContainer splitContainer;
|
||||||
|
private Label lblElapsed;
|
||||||
|
private Label label4;
|
||||||
|
private GroupBox groupBox3;
|
||||||
|
private TextBox tbLine2X2;
|
||||||
|
private Label label11;
|
||||||
|
private TextBox tbLine2Y2;
|
||||||
|
private Label label12;
|
||||||
|
private TextBox tbLine2X1;
|
||||||
|
private TextBox tbLine2Y1;
|
||||||
|
private Label label13;
|
||||||
|
private Label label14;
|
||||||
|
private Label label1;
|
||||||
|
private Label label2;
|
||||||
|
private NumericUpDown NumRectWidth2;
|
||||||
|
private NumericUpDown NumRectWidth1;
|
||||||
|
private Label lblDistance;
|
||||||
|
private Label label17;
|
||||||
|
private Label lblResult;
|
||||||
|
private Label label15;
|
||||||
|
private Button btnSave;
|
||||||
|
}
|
||||||
|
}
|
526
CanFly/UI/SizePanel/SizeGuideLineLineCtrl.cs
Normal file
526
CanFly/UI/SizePanel/SizeGuideLineLineCtrl.cs
Normal file
@@ -0,0 +1,526 @@
|
|||||||
|
using CanFly.Canvas.Helper;
|
||||||
|
using CanFly.Canvas.Shape;
|
||||||
|
using CanFly.Helper;
|
||||||
|
using HalconDotNet;
|
||||||
|
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;
|
||||||
|
|
||||||
|
namespace CanFly.UI.SizePanel
|
||||||
|
{
|
||||||
|
public partial class SizeGuideLineLineCtrl : SizeBaseGuideControl
|
||||||
|
{
|
||||||
|
private FlyShape? _line1;
|
||||||
|
private FlyShape? _line2;
|
||||||
|
|
||||||
|
private float _line1X1;
|
||||||
|
private float _line1Y1;
|
||||||
|
private float _line1X2;
|
||||||
|
private float _line1Y2;
|
||||||
|
private float _lineWidth;
|
||||||
|
|
||||||
|
private float _line2X1;
|
||||||
|
private float _line2Y1;
|
||||||
|
private float _line2X2;
|
||||||
|
private float _line2Y2;
|
||||||
|
private float _line2Width;
|
||||||
|
|
||||||
|
protected override string GetScriptFileName() => "LineToLine.hdvp";
|
||||||
|
|
||||||
|
|
||||||
|
public SizeGuideLineLineCtrl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.canvas.mouseMoved += Canvas_mouseMoved;
|
||||||
|
this.canvas.OnShapeUpdateEvent += UpdateShape;
|
||||||
|
this.canvas.selectionChanged += Canvas_selectionChanged;
|
||||||
|
|
||||||
|
this.canvas.OnShapeMoving += Canvas_OnShapeMoving;
|
||||||
|
this.canvas.newShape += Canvas_newShape;
|
||||||
|
|
||||||
|
this.ctrlTitleBar.OnCloseClicked += OnControlClose;
|
||||||
|
NumRectWidth1.ValueChanged -= NumRectWidth1_ValueChanged;
|
||||||
|
NumRectWidth1.Value = 40;
|
||||||
|
NumRectWidth1.ValueChanged += NumRectWidth1_ValueChanged;
|
||||||
|
|
||||||
|
NumRectWidth2.ValueChanged -= NumericUpDown2_ValueChanged;
|
||||||
|
NumRectWidth2.Value = 40;
|
||||||
|
NumRectWidth2.ValueChanged += NumericUpDown2_ValueChanged;
|
||||||
|
|
||||||
|
}
|
||||||
|
protected override void UpdateShape(FlyShape shape)
|
||||||
|
{
|
||||||
|
switch (shape.ShapeType)
|
||||||
|
{
|
||||||
|
case ShapeTypeEnum.Line:
|
||||||
|
// 判断是否为第一条直线或第二条直线
|
||||||
|
if (_line1 == shape)
|
||||||
|
{
|
||||||
|
//_line1 = shape;
|
||||||
|
var pts1 = _line1.Points;
|
||||||
|
_line1X1 = pts1[0].X;
|
||||||
|
_line1Y1 = pts1[0].Y;
|
||||||
|
_line1X2 = pts1[1].X;
|
||||||
|
_line1Y2 = pts1[1].Y;
|
||||||
|
_lineWidth = _line1.LineVirtualRectWidth;
|
||||||
|
|
||||||
|
tbLine1X1.Text = _line1X1.ToString("F3");
|
||||||
|
tbLine1Y1.Text = _line1Y1.ToString("F3");
|
||||||
|
tbLine1X2.Text = _line1X2.ToString("F3");
|
||||||
|
tbLine1Y2.Text = _line1Y2.ToString("F3");
|
||||||
|
//NumRectWidth1.Value = (decimal)_lineWidth;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//_line2 = shape;
|
||||||
|
var pts2 = _line2.Points;
|
||||||
|
_line2X1 = pts2[0].X;
|
||||||
|
_line2Y1 = pts2[0].Y;
|
||||||
|
_line2X2 = pts2[1].X;
|
||||||
|
_line2Y2 = pts2[1].Y;
|
||||||
|
_line2Width = _line2.LineVirtualRectWidth;
|
||||||
|
|
||||||
|
tbLine2X1.Text = _line2X1.ToString("F3");
|
||||||
|
tbLine2Y1.Text = _line2Y1.ToString("F3");
|
||||||
|
tbLine2X2.Text = _line2X2.ToString("F3");
|
||||||
|
tbLine2Y2.Text = _line2Y2.ToString("F3");
|
||||||
|
// NumRectWidth2.Value = (decimal)_line2Width;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void GuideLineCircleCtrl_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_mouseMoved(PointF pos)
|
||||||
|
{
|
||||||
|
if (InvokeRequired)
|
||||||
|
{
|
||||||
|
Invoke(Canvas_mouseMoved, pos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lblStatus.Text = $"X:{pos.X}, Y:{pos.Y}";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_selectionChanged(List<FlyShape> shapes)
|
||||||
|
{
|
||||||
|
//if (shapes.Count != 1)
|
||||||
|
//{
|
||||||
|
// // panelGuide.Controls.Clear();
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
//SwitchGuideForm(shapes[0].ShapeType);
|
||||||
|
// Canvas_OnShapeUpdateEvent(shapes[0]);
|
||||||
|
|
||||||
|
if (shapes.Count != 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UpdateShape(shapes[0]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_OnShapeMoving(List<FlyShape> shapes)
|
||||||
|
{
|
||||||
|
if (shapes.Count != 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateShape(shapes[0]);
|
||||||
|
}
|
||||||
|
private void Canvas_newShape()
|
||||||
|
{
|
||||||
|
// 自动切换到下一条直线绘制
|
||||||
|
if (_line1 == null)
|
||||||
|
{
|
||||||
|
_line1 = this.canvas.Shapes.LastOrDefault(shp => shp.ShapeType == ShapeTypeEnum.Line);
|
||||||
|
}
|
||||||
|
else if (_line2 == null)
|
||||||
|
{
|
||||||
|
_line2 = this.canvas.Shapes.LastOrDefault(shp => shp.ShapeType == ShapeTypeEnum.Line);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 停止绘制模式,用户可以根据需要重新启用
|
||||||
|
this.canvas.StopDraw();
|
||||||
|
//this.canvas.StopDraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnCreateLineOne_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// this.canvas.Shapes.RemoveAll(shp => shp == _line1); // 移除第一条直线
|
||||||
|
this._line1 = null;
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
this.canvas.StartDraw(ShapeTypeEnum.Line); // 启动绘制模式
|
||||||
|
this.canvas.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnCreateLineTwo_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// this.canvas.Shapes.RemoveAll(shp => shp == _line2); // 移除第二条直线
|
||||||
|
this._line2 = null;
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
this.canvas.StartDraw(ShapeTypeEnum.Line); // 启动绘制模式
|
||||||
|
this.canvas.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnExecute_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (this.canvas.pixmap == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先打开图片");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.canvas.OutsideShapes.Clear();
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
|
||||||
|
flag = new List<double>();
|
||||||
|
Distance = new List<double>();
|
||||||
|
Line1_RowBegin = new List<double>();
|
||||||
|
Line1_ColBegin = new List<double>();
|
||||||
|
Line1_RowEnd = new List<double>();
|
||||||
|
Line1_ColEnd = new List<double>();
|
||||||
|
Line2_RowBegin = new List<double>();
|
||||||
|
Line2_ColBegin = new List<double>();
|
||||||
|
Line2_RowEnd = new List<double>();
|
||||||
|
Line2_ColEnd = new List<double>();
|
||||||
|
Dictionary<string, HObject> inputImg = new Dictionary<string, HObject>();
|
||||||
|
|
||||||
|
if (hImage == null)
|
||||||
|
{
|
||||||
|
HOperatorSet.ReadImage(out hImage, CurrentImageFile);
|
||||||
|
}
|
||||||
|
inputImg["INPUT_Image"] = hImage;
|
||||||
|
|
||||||
|
Dictionary<string, HTuple> inputPara = new Dictionary<string, HTuple>();
|
||||||
|
|
||||||
|
|
||||||
|
// 获取矩形的 4 个点
|
||||||
|
PointF[] Points = this._line1.LineVirtualRectPoints;
|
||||||
|
if (Points.Count() < 4)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PointF Point1 = Points[0];
|
||||||
|
PointF Point2 = Points[1];
|
||||||
|
PointF Point3 = Points[2];
|
||||||
|
PointF Point4 = Points[3];
|
||||||
|
PointF Point5 = Points[0];
|
||||||
|
|
||||||
|
float x1 = Point1.X;
|
||||||
|
float y1 = Point1.Y;
|
||||||
|
|
||||||
|
float x2 = Point2.X;
|
||||||
|
float y2 = Point2.Y;
|
||||||
|
|
||||||
|
float x3 = Point3.X;
|
||||||
|
float y3 = Point3.Y;
|
||||||
|
|
||||||
|
float x4 = Point4.X;
|
||||||
|
float y4 = Point4.Y;
|
||||||
|
|
||||||
|
float x5 = Point5.X;
|
||||||
|
float y5 = Point5.Y;
|
||||||
|
|
||||||
|
|
||||||
|
float[] array1X = new float[] { x1, x2, x3, x4, x5 };
|
||||||
|
HTuple hTupleArray1X = new HTuple(array1X);
|
||||||
|
|
||||||
|
float[] array1Y = new float[] { y1, y2, y3, y4, y5 };
|
||||||
|
HTuple hTupleArray1Y = new HTuple(array1Y);
|
||||||
|
|
||||||
|
|
||||||
|
strarray1X = string.Join(",", array1X);
|
||||||
|
strarray1Y = string.Join(",", array1Y);
|
||||||
|
|
||||||
|
|
||||||
|
// 获取矩形的 4 个点
|
||||||
|
PointF[] Points2 = this._line2.LineVirtualRectPoints;
|
||||||
|
if (Points2.Count() < 4)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PointF Point21 = Points2[0];
|
||||||
|
PointF Point22 = Points2[1];
|
||||||
|
PointF Point23 = Points2[2];
|
||||||
|
PointF Point24 = Points2[3];
|
||||||
|
PointF Point25 = Points2[0];
|
||||||
|
|
||||||
|
float x21 = Point21.X;
|
||||||
|
float y21 = Point21.Y;
|
||||||
|
|
||||||
|
float x22 = Point22.X;
|
||||||
|
float y22 = Point22.Y;
|
||||||
|
|
||||||
|
float x23 = Point23.X;
|
||||||
|
float y23 = Point23.Y;
|
||||||
|
|
||||||
|
float x24 = Point24.X;
|
||||||
|
float y24 = Point24.Y;
|
||||||
|
|
||||||
|
float x25 = Point25.X;
|
||||||
|
float y25 = Point25.Y;
|
||||||
|
|
||||||
|
|
||||||
|
float[] array2X = new float[] { x21, x22, x23, x24, x25 };
|
||||||
|
HTuple hTupleArray2X = new HTuple(array2X);
|
||||||
|
|
||||||
|
float[] array2Y = new float[] { y21, y22, y23, y24, y25 };
|
||||||
|
HTuple hTupleArray2Y = new HTuple(array2Y);
|
||||||
|
|
||||||
|
|
||||||
|
strarray2X = string.Join(",", array2X);
|
||||||
|
strarray2Y = string.Join(",", array2Y);
|
||||||
|
|
||||||
|
inputPara["Line1_LX"] = _line1X1;
|
||||||
|
inputPara["Line1_LY"] = _line1Y1;
|
||||||
|
inputPara["Line1_RX"] = _line1X2;
|
||||||
|
inputPara["Line1_RY"] = _line1Y2;
|
||||||
|
|
||||||
|
inputPara["Line2_LX"] = _line2X1;
|
||||||
|
inputPara["Line2_LY"] = _line2Y1;
|
||||||
|
inputPara["Line2_RX"] = _line2X2;
|
||||||
|
inputPara["Line2_RY"] = _line2Y2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
inputPara["Line1_XRect"] = hTupleArray1X;
|
||||||
|
inputPara["Line1_YRect"] = hTupleArray1Y;
|
||||||
|
|
||||||
|
inputPara["Line2_XRect"] = hTupleArray2X;
|
||||||
|
inputPara["Line2_YRect"] = hTupleArray2Y;
|
||||||
|
|
||||||
|
List<string> outputKeys = new List<string>()
|
||||||
|
{
|
||||||
|
"OUTPUT_Flag",
|
||||||
|
"Distance",
|
||||||
|
"Line1_RowBegin",
|
||||||
|
"Line1_ColBegin",
|
||||||
|
"Line1_RowEnd",
|
||||||
|
"Line1_ColEnd",
|
||||||
|
"Line2_RowBegin",
|
||||||
|
"Line2_ColBegin",
|
||||||
|
"Line2_RowEnd",
|
||||||
|
"Line2_ColEnd"
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
ExecuteHScript(
|
||||||
|
inputImg,
|
||||||
|
inputPara,
|
||||||
|
outputKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void btnLoadImage_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OpenImageFile(bitmap =>
|
||||||
|
{
|
||||||
|
this.canvas.LoadPixmap(bitmap);
|
||||||
|
this.canvas.Enabled = true;
|
||||||
|
_line1 = new FlyShape();
|
||||||
|
_line2 = new FlyShape();
|
||||||
|
_line1.AddPoint(new Point(10, 10));
|
||||||
|
_line1.AddPoint(new Point(50, 10));
|
||||||
|
_line2.AddPoint(new Point(10, 20));
|
||||||
|
_line2.AddPoint(new Point(60, 20));
|
||||||
|
_line1.ShapeType = ShapeTypeEnum.Line;
|
||||||
|
_line2.ShapeType = ShapeTypeEnum.Line;
|
||||||
|
|
||||||
|
_line1.IsDrawLineVirtualRect = true;
|
||||||
|
_line1.LineVirtualRectWidth = 40;
|
||||||
|
_line2.IsDrawLineVirtualRect = true;
|
||||||
|
_line2.LineVirtualRectWidth = 40;
|
||||||
|
|
||||||
|
canvas.Shapes.Add(_line1);
|
||||||
|
canvas.Shapes.Add(_line2);
|
||||||
|
canvas.Invalidate();
|
||||||
|
|
||||||
|
UpdateShape(_line1);
|
||||||
|
UpdateShape(_line2);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
string strarray1X = string.Empty;
|
||||||
|
string strarray1Y = string.Empty;
|
||||||
|
string strarray2X = string.Empty;
|
||||||
|
string strarray2Y = string.Empty;
|
||||||
|
List<double> flag =new List<double>();
|
||||||
|
List<double> Distance = new List<double>();
|
||||||
|
List<double> Line1_RowBegin = new List<double>();
|
||||||
|
List<double> Line1_ColBegin = new List<double>();
|
||||||
|
List<double> Line1_RowEnd = new List<double>();
|
||||||
|
List<double> Line1_ColEnd = new List<double>();
|
||||||
|
List<double> Line2_RowBegin = new List<double>();
|
||||||
|
List<double> Line2_ColBegin = new List<double>();
|
||||||
|
List<double> Line2_RowEnd = new List<double>();
|
||||||
|
List<double> Line2_ColEnd = new List<double>();
|
||||||
|
protected override void OnExecuteHScriptResult(
|
||||||
|
bool success,
|
||||||
|
Dictionary<string, HTuple> resultDic,
|
||||||
|
int timeElasped)
|
||||||
|
{
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//"OUTPUT_Flag",
|
||||||
|
// "Distance",
|
||||||
|
// "Line1_RowBegin",
|
||||||
|
// "Line1_ColBegin",
|
||||||
|
// "Line1_RowEnd",
|
||||||
|
// "Line1_ColEnd",
|
||||||
|
// "Line2_RowBegin",
|
||||||
|
// "Line2_ColBegin",
|
||||||
|
// "Line2_RowEnd",
|
||||||
|
// "Line2_ColEnd"
|
||||||
|
|
||||||
|
|
||||||
|
flag = resultDic["OUTPUT_Flag"].HTupleToDouble();
|
||||||
|
Distance = resultDic["Distance"].HTupleToDouble();
|
||||||
|
Line1_RowBegin = resultDic["Line1_RowBegin"].HTupleToDouble();
|
||||||
|
Line1_ColBegin = resultDic["Line1_ColBegin"].HTupleToDouble();
|
||||||
|
Line1_RowEnd = resultDic["Line1_RowEnd"].HTupleToDouble();
|
||||||
|
Line1_ColEnd = resultDic["Line1_ColEnd"].HTupleToDouble();
|
||||||
|
Line2_RowBegin = resultDic["Line2_RowBegin"].HTupleToDouble();
|
||||||
|
Line2_ColBegin = resultDic["Line2_ColBegin"].HTupleToDouble();
|
||||||
|
Line2_RowEnd = resultDic["Line2_RowEnd"].HTupleToDouble();
|
||||||
|
Line2_ColEnd = resultDic["Line2_ColEnd"].HTupleToDouble();
|
||||||
|
|
||||||
|
if (flag.Count > 0)
|
||||||
|
{
|
||||||
|
lblResult.Text = flag[0].ToString();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblResult.Text = "无";
|
||||||
|
}
|
||||||
|
if (Distance.Count > 0)
|
||||||
|
{
|
||||||
|
lblDistance.Text = Distance[0].ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lblDistance.Text = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag.Count > 0 && Distance.Count > 0 && Line1_RowBegin.Count > 0 && Line1_ColBegin.Count > 0 && Line1_RowEnd.Count > 0 && Line1_ColEnd.Count > 0 && Line2_RowBegin.Count > 0 && Line2_ColBegin.Count > 0 && Line2_RowEnd.Count > 0 && Line2_ColEnd.Count > 0)
|
||||||
|
{
|
||||||
|
float width = 0;
|
||||||
|
this.canvas.DrawLine(new PointF((float)Line1_ColBegin[0], (float)Line1_RowBegin[0]), new PointF((float)Line1_ColEnd[0], (float)Line1_RowEnd[0]), width);
|
||||||
|
this.canvas.DrawLine(new PointF((float)Line2_ColBegin[0], (float)Line2_RowBegin[0]), new PointF((float)Line2_ColEnd[0], (float)Line2_RowEnd[0]), width);
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
lblElapsed.Text = $"{timeElasped} ms";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NumRectWidth1_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_line1 != null)
|
||||||
|
{
|
||||||
|
//_line1.IsDrawLineVirtualRect = true;
|
||||||
|
_line1.LineVirtualRectWidth = (float)NumRectWidth1.Value;
|
||||||
|
UpdateShape(_line1);
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NumericUpDown2_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_line2 != null)
|
||||||
|
{
|
||||||
|
// _line2.IsDrawLineVirtualRect = true;
|
||||||
|
_line2.LineVirtualRectWidth = (float)NumRectWidth2.Value;
|
||||||
|
UpdateShape(_line2);
|
||||||
|
this.canvas.Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (lblResult.Text.Equals("无"))
|
||||||
|
{
|
||||||
|
MessageBox.Show("请先进行绘制");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (lblResult.Text != "0")
|
||||||
|
{
|
||||||
|
MessageBox.Show("测量计算错误,无法保存");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//inputPara["Line1_LX"] = _line1X1;
|
||||||
|
//inputPara["Line1_LY"] = _line1Y1;
|
||||||
|
//inputPara["Line1_RX"] = _line1X2;
|
||||||
|
//inputPara["Line1_RY"] = _line1Y2;
|
||||||
|
|
||||||
|
//inputPara["Line2_LX"] = _line2X1;
|
||||||
|
//inputPara["Line2_LY"] = _line2Y1;
|
||||||
|
//inputPara["Line2_RX"] = _line2X2;
|
||||||
|
//inputPara["Line2_RY"] = _line2Y2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//inputPara["Line1_XRect"] = hTupleArray1X;
|
||||||
|
//inputPara["Line1_YRect"] = hTupleArray1Y;
|
||||||
|
|
||||||
|
//inputPara["Line2_XRect"] = hTupleArray2X;
|
||||||
|
//inputPara["Line2_YRect"] = hTupleArray2Y;
|
||||||
|
|
||||||
|
|
||||||
|
string input = $"Line1_LX:{_line1X1};" +
|
||||||
|
$"Line1_LY:{_line1Y1};" +
|
||||||
|
$"Line1_RX:{_line1X2};" +
|
||||||
|
$"Line1_RY:{_line1Y2};" +
|
||||||
|
$"Line2_LX:{_line2X1};" +
|
||||||
|
$"Line2_LY:{_line2Y1};" +
|
||||||
|
$"Line2_RX:{_line2X2};" +
|
||||||
|
$"Line2_RY:{_line2Y2};" +
|
||||||
|
$"Line1_XRect:{strarray1X};" +
|
||||||
|
$"Line1_YRect:{strarray1Y};" +
|
||||||
|
$"Line2_XRect:{strarray2X};" +
|
||||||
|
$"Line2_YRect:{strarray2Y}"
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
string result = $"Distance:{Distance[0]}";
|
||||||
|
|
||||||
|
|
||||||
|
DataToTriggerEvent(input, result);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
145
CanFly/UI/SizePanel/SizeGuideLineLineCtrl.resx
Normal file
145
CanFly/UI/SizePanel/SizeGuideLineLineCtrl.resx
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
<?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>
|
||||||
|
<data name="canvas.OutsideShapes" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>
|
||||||
|
AAEAAAD/////AQAAAAAAAAAMAgAAAERDYW5GbHkuQ2FudmFzLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1
|
||||||
|
cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAQBAAAAdlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5l
|
||||||
|
cmljLkxpc3RgMVtbQ2FuRmx5LkNhbnZhcy5TaGFwZS5GbHlTaGFwZSwgQ2FuRmx5LkNhbnZhcywgQ3Vs
|
||||||
|
dHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsXV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lv
|
||||||
|
bgQAAB5DYW5GbHkuQ2FudmFzLlNoYXBlLkZseVNoYXBlW10CAAAACAgJAwAAAAAAAAAAAAAADAQAAAAz
|
||||||
|
Q2FuRmx5LkNhbnZhcywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBwMAAAAAAQAA
|
||||||
|
AAAAAAAEHENhbkZseS5DYW52YXMuU2hhcGUuRmx5U2hhcGUEAAAACw==
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<data name="canvas.Shapes" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>
|
||||||
|
AAEAAAD/////AQAAAAAAAAAMAgAAAERDYW5GbHkuQ2FudmFzLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1
|
||||||
|
cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbAQBAAAAdlN5c3RlbS5Db2xsZWN0aW9ucy5HZW5l
|
||||||
|
cmljLkxpc3RgMVtbQ2FuRmx5LkNhbnZhcy5TaGFwZS5GbHlTaGFwZSwgQ2FuRmx5LkNhbnZhcywgQ3Vs
|
||||||
|
dHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsXV0DAAAABl9pdGVtcwVfc2l6ZQhfdmVyc2lv
|
||||||
|
bgQAAB5DYW5GbHkuQ2FudmFzLlNoYXBlLkZseVNoYXBlW10CAAAACAgJAwAAAAAAAAAAAAAADAQAAAAz
|
||||||
|
Q2FuRmx5LkNhbnZhcywgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBwMAAAAAAQAA
|
||||||
|
AAAAAAAEHENhbkZseS5DYW52YXMuU2hhcGUuRmx5U2hhcGUEAAAACw==
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
93
CanFly/UI/UIMain/FrmMainSize.Designer.cs
generated
Normal file
93
CanFly/UI/UIMain/FrmMainSize.Designer.cs
generated
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
|
||||||
|
|
||||||
|
namespace XKRS.CanFly
|
||||||
|
{
|
||||||
|
partial class FrmMainSize
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
statusStrip1 = new StatusStrip();
|
||||||
|
panelContent = new Panel();
|
||||||
|
pageHeader1 = new AntdUI.PageHeader();
|
||||||
|
panelContent.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// statusStrip1
|
||||||
|
//
|
||||||
|
statusStrip1.Location = new Point(0, 808);
|
||||||
|
statusStrip1.Name = "statusStrip1";
|
||||||
|
statusStrip1.Size = new Size(1185, 22);
|
||||||
|
statusStrip1.TabIndex = 4;
|
||||||
|
statusStrip1.Text = "statusStrip1";
|
||||||
|
//
|
||||||
|
// panelContent
|
||||||
|
//
|
||||||
|
panelContent.Controls.Add(pageHeader1);
|
||||||
|
panelContent.Dock = DockStyle.Fill;
|
||||||
|
panelContent.Location = new Point(0, 0);
|
||||||
|
panelContent.Margin = new Padding(4, 3, 4, 3);
|
||||||
|
panelContent.Name = "panelContent";
|
||||||
|
panelContent.Size = new Size(1185, 808);
|
||||||
|
panelContent.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// pageHeader1
|
||||||
|
//
|
||||||
|
pageHeader1.BackColor = Color.FromArgb(46, 108, 227);
|
||||||
|
pageHeader1.Dock = DockStyle.Top;
|
||||||
|
pageHeader1.Location = new Point(0, 0);
|
||||||
|
pageHeader1.Mode = AntdUI.TAMode.Dark;
|
||||||
|
pageHeader1.Name = "pageHeader1";
|
||||||
|
pageHeader1.ShowButton = true;
|
||||||
|
pageHeader1.ShowIcon = true;
|
||||||
|
pageHeader1.Size = new Size(1185, 33);
|
||||||
|
pageHeader1.TabIndex = 2;
|
||||||
|
pageHeader1.Text = "尺寸测量";
|
||||||
|
//
|
||||||
|
// FrmMainSize
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1185, 830);
|
||||||
|
Controls.Add(panelContent);
|
||||||
|
Controls.Add(statusStrip1);
|
||||||
|
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||||
|
Margin = new Padding(2, 3, 2, 3);
|
||||||
|
Name = "FrmMainSize";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "尺寸测量";
|
||||||
|
Load += FrmMain_Load;
|
||||||
|
panelContent.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
private StatusStrip statusStrip1;
|
||||||
|
private Panel panelContent;
|
||||||
|
private AntdUI.PageHeader pageHeader1;
|
||||||
|
}
|
||||||
|
}
|
440
CanFly/UI/UIMain/FrmMainSize.cs
Normal file
440
CanFly/UI/UIMain/FrmMainSize.cs
Normal file
@@ -0,0 +1,440 @@
|
|||||||
|
using AntdUI;
|
||||||
|
using CanFly.Canvas.Shape;
|
||||||
|
using CanFly.Helper;
|
||||||
|
using CanFly.UI;
|
||||||
|
using CanFly.UI.GuidePanel;
|
||||||
|
using CanFly.UI.SizePanel;
|
||||||
|
using CanFly.Util;
|
||||||
|
using DH.Commons.Base;
|
||||||
|
using HalconDotNet;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace XKRS.CanFly
|
||||||
|
{
|
||||||
|
|
||||||
|
public partial class FrmMainSize : Window
|
||||||
|
{
|
||||||
|
|
||||||
|
private string _currentImageFile = "";
|
||||||
|
private System.Windows.Forms.Timer _statusTimer = new System.Windows.Forms.Timer();
|
||||||
|
private SizeBaseGuideControl? _currentGuideCtrl;
|
||||||
|
|
||||||
|
|
||||||
|
private SizeGuideCircleCtrl guideCircleCtrl = new SizeGuideCircleCtrl();
|
||||||
|
private SizeGuideLineCircleCtrl guideLineCircleCtrl = new SizeGuideLineCircleCtrl();
|
||||||
|
private SizeGuideLineLineCtrl guideLineLineCtrl = new SizeGuideLineLineCtrl();
|
||||||
|
private SizeGuideLineCtrl guideLineCtrl = new SizeGuideLineCtrl();
|
||||||
|
private SizeGuideHeightCtrl guideHeightCtrl = new SizeGuideHeightCtrl();
|
||||||
|
string Type=string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
public string inputtext=string.Empty;
|
||||||
|
public string outtext = string.Empty;
|
||||||
|
DetectionConfig DetectionConfig;
|
||||||
|
public FrmMainSize(string type,DetectionConfig detectionConfig)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
DetectionConfig = detectionConfig;
|
||||||
|
Type=type;
|
||||||
|
|
||||||
|
guideCircleCtrl.Dock = DockStyle.Fill;
|
||||||
|
guideCircleCtrl.OnControlCloseEvent -= () => panelContent.Controls.Clear();
|
||||||
|
guideCircleCtrl.OnControlCloseEvent += () => panelContent.Controls.Clear();
|
||||||
|
|
||||||
|
|
||||||
|
guideLineCircleCtrl.Dock = DockStyle.Fill;
|
||||||
|
guideLineCircleCtrl.OnControlCloseEvent -= () => panelContent.Controls.Clear();
|
||||||
|
guideLineCircleCtrl.OnControlCloseEvent += () => panelContent.Controls.Clear();
|
||||||
|
|
||||||
|
guideLineLineCtrl.Dock = DockStyle.Fill;
|
||||||
|
guideLineLineCtrl.OnControlCloseEvent -= () => panelContent.Controls.Clear();
|
||||||
|
guideLineLineCtrl.OnControlCloseEvent += () => panelContent.Controls.Clear();
|
||||||
|
|
||||||
|
guideLineCtrl.Dock = DockStyle.Fill;
|
||||||
|
guideLineCtrl.OnControlCloseEvent -= () => panelContent.Controls.Clear();
|
||||||
|
guideLineCtrl.OnControlCloseEvent += () => panelContent.Controls.Clear();
|
||||||
|
|
||||||
|
|
||||||
|
guideHeightCtrl.Dock = DockStyle.Fill;
|
||||||
|
guideHeightCtrl.OnControlCloseEvent -= () => panelContent.Controls.Clear();
|
||||||
|
guideHeightCtrl.OnControlCloseEvent += () => panelContent.Controls.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void FrmMain_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
switch (Type)
|
||||||
|
{
|
||||||
|
case "1":
|
||||||
|
SwitchMeasureMode(guideCircleCtrl);
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
SwitchMeasureMode(guideLineCtrl);
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
SwitchMeasureMode(guideLineLineCtrl);
|
||||||
|
break;
|
||||||
|
case "4":
|
||||||
|
SwitchMeasureMode(guideLineCircleCtrl);
|
||||||
|
break;
|
||||||
|
case "5":
|
||||||
|
SwitchMeasureMode(guideHeightCtrl);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void btnLoadImage_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//OpenFileDialog ofd = new OpenFileDialog();
|
||||||
|
//ofd.Filter = "ͼ<><CDBC><EFBFBD>ļ<EFBFBD>|*.jpg;*.png";
|
||||||
|
//ofd.Multiselect = false;
|
||||||
|
//if (ofd.ShowDialog() == DialogResult.OK)
|
||||||
|
//{
|
||||||
|
// _currentImageFile = ofd.FileName;
|
||||||
|
// Bitmap bitmap = (Bitmap)Image.FromFile(_currentImageFile);
|
||||||
|
// this.canvas.LoadPixmap(bitmap);
|
||||||
|
// this.btnCreateCircle.Enabled = true;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void btnMeasureCircle_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//var contentCtrls = panelContent.Controls;
|
||||||
|
|
||||||
|
//if (contentCtrls.Count > 0)
|
||||||
|
//{
|
||||||
|
// if (contentCtrls[0] == guideCircleCtrl)
|
||||||
|
// {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//panelContent.Controls.Clear();
|
||||||
|
//panelContent.Controls.Add(guideCircleCtrl);
|
||||||
|
|
||||||
|
SwitchMeasureMode(guideCircleCtrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void btnMeasureLineCircle_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SwitchMeasureMode(guideLineCircleCtrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void SwitchMeasureMode(SizeBaseGuideControl control)
|
||||||
|
{
|
||||||
|
var contentCtrls = panelContent.Controls;
|
||||||
|
|
||||||
|
if (contentCtrls.Count > 0)
|
||||||
|
{
|
||||||
|
if (contentCtrls[0] == control)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
panelContent.Controls.Clear();
|
||||||
|
|
||||||
|
control.OnDataPassed -= Control_OnDataPassed;
|
||||||
|
control.OnDataPassed += Control_OnDataPassed;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//control.Dock = DockStyle.Fill;
|
||||||
|
//control.OnControlCloseEvent -= () => panelContent.Controls.Clear();
|
||||||
|
//control.OnControlCloseEvent += () => panelContent.Controls.Clear();
|
||||||
|
panelContent.Controls.Add(control);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Control_OnDataPassed(string obj,string obj1)
|
||||||
|
{
|
||||||
|
inputtext = obj;
|
||||||
|
outtext = obj1;
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnCreateRect_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//this.canvas.StartDraw(ShapeTypeEnum.Rectangle);
|
||||||
|
//this.btnCreateCircle.Enabled = false;
|
||||||
|
//this.btnStopDraw.Enabled = true;
|
||||||
|
//this.canvas.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void btnStopDraw_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//panelGuide.Controls.Clear();
|
||||||
|
StopDrawMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void StartDrawMode()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void StopDrawMode()
|
||||||
|
{
|
||||||
|
//this.canvas.StopDraw();
|
||||||
|
|
||||||
|
|
||||||
|
//this.btnStopDraw.Enabled = false;
|
||||||
|
//this.btnCreateCircle.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Status(string message, int delay = 5000)
|
||||||
|
{
|
||||||
|
//_statusTimer.Stop();
|
||||||
|
//// <20><>ʾ<EFBFBD><CABE>Ϣ
|
||||||
|
//lblStatus.Text = message;
|
||||||
|
|
||||||
|
//// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||||
|
|
||||||
|
//_statusTimer.Interval = delay; // <20><><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD>ʱ<EFBFBD><CAB1>
|
||||||
|
//_statusTimer.Tick += (sender, e) =>
|
||||||
|
//{
|
||||||
|
// _statusTimer.Stop(); // ֹͣ<CDA3><D6B9>ʱ<EFBFBD><CAB1>
|
||||||
|
// lblStatus.Text = string.Empty; // <20><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>Ϣ
|
||||||
|
//};
|
||||||
|
//_statusTimer.Start(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_mouseMoved(PointF pos)
|
||||||
|
{
|
||||||
|
//if (InvokeRequired)
|
||||||
|
//{
|
||||||
|
// Invoke(Canvas_mouseMoved, pos);
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//lblStatus.Text = $"X:{pos.X}, Y:{pos.Y}";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_selectionChanged(List<FlyShape> shapes)
|
||||||
|
{
|
||||||
|
if (shapes.Count != 1)
|
||||||
|
{
|
||||||
|
// panelGuide.Controls.Clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//SwitchGuideForm(shapes[0].ShapeType);
|
||||||
|
Canvas_OnShapeUpdateEvent(shapes[0]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void SwitchGuideForm(ShapeTypeEnum shapeType)
|
||||||
|
{
|
||||||
|
//if (_currentGuideCtrl == null)
|
||||||
|
//{
|
||||||
|
// switch (shapeType)
|
||||||
|
// {
|
||||||
|
// case ShapeTypeEnum.Point:
|
||||||
|
// break;
|
||||||
|
// case ShapeTypeEnum.Line:
|
||||||
|
// break;
|
||||||
|
// case ShapeTypeEnum.Rectangle:
|
||||||
|
// break;
|
||||||
|
// case ShapeTypeEnum.Circle:
|
||||||
|
// _currentGuideCtrl = new GuideCircleCtrl();
|
||||||
|
// _currentGuideCtrl.ImageFile = _currentImageFile;
|
||||||
|
// _currentGuideCtrl.OnDrawCircle += this.canvas.DrawCircle;
|
||||||
|
// _currentGuideCtrl.OnClose += () =>
|
||||||
|
// {
|
||||||
|
// panelGuide.Controls.Clear();
|
||||||
|
// StopDrawMode();
|
||||||
|
// };
|
||||||
|
// break;
|
||||||
|
// case ShapeTypeEnum.Polygon:
|
||||||
|
// break;
|
||||||
|
// case ShapeTypeEnum.LineStrip:
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//_currentGuideCtrl?.AddToPanel(panelGuide);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_OnShapeMoving(List<FlyShape> shapes)
|
||||||
|
{
|
||||||
|
//if (shapes.Count != 1)
|
||||||
|
//{
|
||||||
|
// panelGuide.Controls.Clear();
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//_currentGuideCtrl?.UpdateShape(shapes[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Canvas_OnShapeUpdateEvent(FlyShape shape)
|
||||||
|
{
|
||||||
|
switch (shape.ShapeType)
|
||||||
|
{
|
||||||
|
case ShapeTypeEnum.Point:
|
||||||
|
break;
|
||||||
|
case ShapeTypeEnum.Line:
|
||||||
|
break;
|
||||||
|
case ShapeTypeEnum.Rectangle:
|
||||||
|
break;
|
||||||
|
case ShapeTypeEnum.Circle:
|
||||||
|
{
|
||||||
|
//_currentGuideCtrl?.UpdateShape(shape);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ShapeTypeEnum.Polygon:
|
||||||
|
break;
|
||||||
|
case ShapeTypeEnum.LineStrip:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void btnTestOutsideDraw_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//Random random = new Random((int)DateTime.Now.Ticks);
|
||||||
|
|
||||||
|
//for (int i = 0; i < 10; i++)
|
||||||
|
//{
|
||||||
|
// // this.canvas.DrawCircle(new PointF(500, 500), 100);
|
||||||
|
|
||||||
|
// int x = random.Next() % 500;
|
||||||
|
// int y = random.Next() % 500;
|
||||||
|
// int r = random.Next() % 200;
|
||||||
|
|
||||||
|
// Debug.WriteLine($"X:{x}\tY:{y}\tR:{r}");
|
||||||
|
|
||||||
|
// this.canvas.DrawCircle(new PointF(x, y), r);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnTestClearDraw_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//this.canvas.ClearDraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private async void btnTestCircleMeasure_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//string dir = Path.Combine(Environment.CurrentDirectory, "hscripts");
|
||||||
|
//string file = "CircleMeasure.hdvp";
|
||||||
|
//string filePath = Path.Combine(dir, file);
|
||||||
|
//if (!File.Exists(filePath))
|
||||||
|
//{
|
||||||
|
// MessageBox.Show($"<22>ļ<EFBFBD> {filePath} <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//HObject? hImage = null;
|
||||||
|
|
||||||
|
//try
|
||||||
|
//{
|
||||||
|
// HDevEngineTool tool = new HDevEngineTool(dir);
|
||||||
|
// tool.LoadProcedure(Path.GetFileNameWithoutExtension(file));
|
||||||
|
|
||||||
|
// // string imageFile = Path.Combine(Environment.CurrentDirectory, "hscripts", "image.png");
|
||||||
|
|
||||||
|
// HOperatorSet.ReadImage(out hImage, _currentImageFile);
|
||||||
|
// tool.InputImageDic["INPUT_Image"] = hImage;
|
||||||
|
// tool.InputTupleDic["XCenter"] = 981.625;
|
||||||
|
// tool.InputTupleDic["YCenter"] = 931.823;
|
||||||
|
// tool.InputTupleDic["Radius"] = 900.141;
|
||||||
|
|
||||||
|
// Stopwatch sw = new Stopwatch();
|
||||||
|
// sw.Start();
|
||||||
|
// if (!tool.RunProcedure(out string error, out _))
|
||||||
|
// {
|
||||||
|
// throw new Exception();
|
||||||
|
// }
|
||||||
|
// sw.Stop();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// var flag = tool.GetResultTuple("OUTPUT_Flag").HTupleToDouble();
|
||||||
|
// List<double> x = tool.GetResultTuple("RXCenter").HTupleToDouble();
|
||||||
|
// var y = tool.GetResultTuple("RYCenter").HTupleToDouble();
|
||||||
|
// var r = tool.GetResultTuple("RRadius").HTupleToDouble();
|
||||||
|
|
||||||
|
// if (flag.Count > 0 && x.Count > 0 && y.Count > 0 && r.Count > 0)
|
||||||
|
// {
|
||||||
|
// this.canvas.DrawCircle(new PointF((float)x[0], (float)y[0]), (float)r[0]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// Debug.WriteLine("");
|
||||||
|
//}
|
||||||
|
//catch (Exception)
|
||||||
|
//{
|
||||||
|
// throw;
|
||||||
|
//}
|
||||||
|
//finally
|
||||||
|
//{
|
||||||
|
// hImage?.Dispose();
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnTest_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//this.canvas.DrawRectangle(new PointF(300, 300),
|
||||||
|
// new PointF(800, 500), 33f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void btnRotateTest_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//if (this.canvas.Shapes.Count == 0)
|
||||||
|
//{
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//this.canvas.Shapes[0]._currentRotateAngle += 10;
|
||||||
|
//this.canvas.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnMeasureLineline_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SwitchMeasureMode(guideLineLineCtrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnMeasureLine_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SwitchMeasureMode(guideLineCtrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -117,4 +117,7 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
@@ -11,17 +11,12 @@
|
|||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\CanFly.Canvas\CanFly.Canvas.csproj" />
|
<ProjectReference Include="..\CanFly.Canvas\CanFly.Canvas.csproj" />
|
||||||
|
<ProjectReference Include="..\DH.Commons\DH.Commons.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -29,6 +24,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AntdUI" Version="1.8.9" />
|
||||||
<PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" />
|
<PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" />
|
||||||
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.10.0.20241108" />
|
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.10.0.20241108" />
|
||||||
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.10.0.20241108" />
|
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.10.0.20241108" />
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AntdUI" Version="1.8.9" />
|
<PackageReference Include="AntdUI" Version="1.8.9" />
|
||||||
|
<PackageReference Include="hyjiacan.pinyin4net" Version="4.1.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" />
|
<PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" />
|
||||||
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.10.0.20241108" />
|
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.10.0.20241108" />
|
||||||
|
@@ -5,6 +5,7 @@ using System.Text.Json;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using AntdUI;
|
using AntdUI;
|
||||||
using DH.Commons.Base;
|
using DH.Commons.Base;
|
||||||
|
using DH.Commons.Enums;
|
||||||
using DH.Commons.Models;
|
using DH.Commons.Models;
|
||||||
|
|
||||||
namespace DH.Commons.Helper
|
namespace DH.Commons.Helper
|
||||||
@@ -127,6 +128,13 @@ namespace DH.Commons.Helper
|
|||||||
{
|
{
|
||||||
foreach (var label in config.DetectionLableList)
|
foreach (var label in config.DetectionLableList)
|
||||||
{
|
{
|
||||||
|
//是否假如判断标签为中文转为为英文
|
||||||
|
//string pinyinlabel = FileHelper.ConvertHanzitoPinyinWithNumbers(label.LabelName.ToString());
|
||||||
|
//if (FileHelper.IsAlphaNumericOnly(pinyinlabel))
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
// 根据实际需求格式化输出
|
// 根据实际需求格式化输出
|
||||||
writer.WriteLine(label.LabelName.ToString()); // 假设DetectionLable重写了ToString()
|
writer.WriteLine(label.LabelName.ToString()); // 假设DetectionLable重写了ToString()
|
||||||
|
|
||||||
|
507
DH.Commons/Helper/FileHelper.cs
Normal file
507
DH.Commons/Helper/FileHelper.cs
Normal file
@@ -0,0 +1,507 @@
|
|||||||
|
using hyjiacan.py4n;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DH.Commons.Enums
|
||||||
|
{
|
||||||
|
|
||||||
|
public static class FileHelper
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理两个文件夹中的文件,保留文件名交集部分,其余文件删除。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="imagesFolder">图片文件夹路径</param>
|
||||||
|
/// <param name="labelsFolder">标签文件夹路径</param>
|
||||||
|
public static void CleanupFolders(string imagesFolder, string labelsFolder)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(imagesFolder))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Images folder does not exist: {imagesFolder}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Directory.Exists(labelsFolder))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Labels folder does not exist: {labelsFolder}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取文件名(不包含扩展名)
|
||||||
|
var imageFiles = Directory.GetFiles(imagesFolder)
|
||||||
|
.Select(Path.GetFileNameWithoutExtension)
|
||||||
|
.ToHashSet();
|
||||||
|
|
||||||
|
var labelFiles = Directory.GetFiles(labelsFolder)
|
||||||
|
.Select(Path.GetFileNameWithoutExtension)
|
||||||
|
.ToHashSet();
|
||||||
|
|
||||||
|
// 计算交集
|
||||||
|
var commonFiles = imageFiles.Intersect(labelFiles);
|
||||||
|
|
||||||
|
// 删除 images 文件夹中不在交集中的文件
|
||||||
|
foreach (var imagePath in Directory.GetFiles(imagesFolder))
|
||||||
|
{
|
||||||
|
string fileNameWithoutExt = Path.GetFileNameWithoutExtension(imagePath);
|
||||||
|
if (!commonFiles.Contains(fileNameWithoutExt))
|
||||||
|
{
|
||||||
|
File.Delete(imagePath);
|
||||||
|
Console.WriteLine($"Deleted image file: {imagePath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除 labels 文件夹中不在交集中的文件
|
||||||
|
foreach (var labelPath in Directory.GetFiles(labelsFolder))
|
||||||
|
{
|
||||||
|
string fileNameWithoutExt = Path.GetFileNameWithoutExtension(labelPath);
|
||||||
|
if (!commonFiles.Contains(fileNameWithoutExt))
|
||||||
|
{
|
||||||
|
File.Delete(labelPath);
|
||||||
|
Console.WriteLine($"Deleted label file: {labelPath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("Folders cleaned successfully!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取文件夹中所有图片文件的个数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="folderPath">目标文件夹路径</param>
|
||||||
|
/// <param name="includeSubdirectories">是否包含子文件夹,默认不包含</param>
|
||||||
|
/// <returns>图片文件总数</returns>
|
||||||
|
public static int CountImageFiles(string folderPath, bool includeSubdirectories = false)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(folderPath))
|
||||||
|
{
|
||||||
|
throw new DirectoryNotFoundException($"The folder '{folderPath}' does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支持的图片格式
|
||||||
|
string[] imageExtensions = { "*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif" };
|
||||||
|
|
||||||
|
// 搜索选项
|
||||||
|
SearchOption searchOption = includeSubdirectories ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
|
||||||
|
|
||||||
|
int fileCount = 0;
|
||||||
|
|
||||||
|
foreach (var ext in imageExtensions)
|
||||||
|
{
|
||||||
|
fileCount += Directory.GetFiles(folderPath, ext, searchOption).Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fileCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除一个目录所有子目录和文件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
public static void DeleteDirectoryAndContents(string path)
|
||||||
|
{
|
||||||
|
// 确保目录存在
|
||||||
|
if (Directory.Exists(path))
|
||||||
|
{
|
||||||
|
// 删除目录中的文件
|
||||||
|
string[] files = Directory.GetFiles(path);
|
||||||
|
foreach (var file in files)
|
||||||
|
{
|
||||||
|
File.Delete(file);
|
||||||
|
Console.WriteLine($"文件已删除: {file}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除目录中的子目录
|
||||||
|
string[] directories = Directory.GetDirectories(path);
|
||||||
|
foreach (var directory in directories)
|
||||||
|
{
|
||||||
|
DeleteDirectoryAndContents(directory); // 递归删除子目录
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除空目录
|
||||||
|
Directory.Delete(path);
|
||||||
|
Console.WriteLine($"目录已删除: {path}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("目录不存在!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 将一个文件夹中的所有图片文件和 JSON 文件复制到另一个文件夹中
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sourceDirectory"></param>
|
||||||
|
/// <param name="destinationDirectory"></param>
|
||||||
|
public static void CopyImageAndJsonFiles(string sourceDirectory, string destinationDirectory)
|
||||||
|
{
|
||||||
|
// 确保目标文件夹存在,如果不存在则创建它
|
||||||
|
if (!Directory.Exists(destinationDirectory))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(destinationDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取源文件夹中的所有图片文件和 JSON 文件
|
||||||
|
string[] imageFiles = Directory.GetFiles(sourceDirectory, "*.*")
|
||||||
|
.Where(file => file.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
file.EndsWith(".jpeg", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
file.EndsWith(".png", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
file.EndsWith(".gif", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
file.EndsWith(".bmp", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
file.EndsWith(".tiff", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
file.EndsWith(".webp", StringComparison.OrdinalIgnoreCase))
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
string[] jsonFiles = Directory.GetFiles(sourceDirectory, "*.json");
|
||||||
|
|
||||||
|
// 合并图片文件和 JSON 文件
|
||||||
|
string[] filesToCopy = imageFiles.Concat(jsonFiles).ToArray();
|
||||||
|
|
||||||
|
foreach (string file in filesToCopy)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 获取文件名
|
||||||
|
string fileName = Path.GetFileName(file);
|
||||||
|
|
||||||
|
// 拼接目标文件的完整路径
|
||||||
|
string destinationFile = Path.Combine(destinationDirectory, fileName);
|
||||||
|
|
||||||
|
// 如果目标文件已存在,可以选择覆盖或跳过(这里我们选择跳过)
|
||||||
|
if (File.Exists(destinationFile))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"文件 {fileName} 已存在,跳过复制.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 复制文件
|
||||||
|
File.Copy(file, destinationFile);
|
||||||
|
Console.WriteLine($"文件 {fileName} 已成功复制到 {destinationDirectory}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"复制文件 {file} 时出错: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 遍历图片文件夹,检查对应的标签文件夹中是否有同名的 .txt 文件。
|
||||||
|
/// 如果没有,则创建一个空的 .txt 文件。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="imagesDirectory">图片文件夹路径</param>
|
||||||
|
/// <param name="labelsDirectory">标签文件夹路径</param>
|
||||||
|
public static void ProcessImageFiles(string imagesDirectory, string labelsDirectory)
|
||||||
|
{
|
||||||
|
// 检查 images 目录是否存在
|
||||||
|
if (!Directory.Exists(imagesDirectory))
|
||||||
|
{
|
||||||
|
throw new DirectoryNotFoundException($"目录 {imagesDirectory} 不存在.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查 labels 目录是否存在,如果不存在则创建
|
||||||
|
if (!Directory.Exists(labelsDirectory))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(labelsDirectory);
|
||||||
|
Console.WriteLine($"目录 {labelsDirectory} 已创建.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取 images 目录中的所有文件(包括图片文件)
|
||||||
|
string[] imageFiles = Directory.GetFiles(imagesDirectory, "*.*", SearchOption.TopDirectoryOnly);
|
||||||
|
string[] validExtensions = { ".jpg", ".jpeg", ".png", ".bmp", ".gif" }; // 支持的图片格式
|
||||||
|
|
||||||
|
foreach (var imageFile in imageFiles)
|
||||||
|
{
|
||||||
|
// 检查文件扩展名是否为支持的图片格式
|
||||||
|
string extension = Path.GetExtension(imageFile).ToLower();
|
||||||
|
if (Array.Exists(validExtensions, ext => ext == extension))
|
||||||
|
{
|
||||||
|
// 获取图片文件的文件名(不包括扩展名)
|
||||||
|
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(imageFile);
|
||||||
|
|
||||||
|
// 生成对应的 txt 文件路径
|
||||||
|
string labelFilePath = Path.Combine(labelsDirectory, fileNameWithoutExtension + ".txt");
|
||||||
|
|
||||||
|
// 如果该 txt 文件不存在,则创建一个空白 txt 文件
|
||||||
|
if (!File.Exists(labelFilePath))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.WriteAllText(labelFilePath, string.Empty); // 创建空白 txt 文件
|
||||||
|
Console.WriteLine($"创建空白文件: {labelFilePath}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"无法创建文件 {labelFilePath}: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 封装的函数:删除没有对应 JSON 文件的图片
|
||||||
|
public static void DeleteUnmatchedImages(string labelsFolderPath, string imagesFolderPath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 获取 labels 文件夹中的所有 JSON 文件名(去除扩展名)
|
||||||
|
string[] jsonFiles = Directory.GetFiles(labelsFolderPath, "*.txt");
|
||||||
|
HashSet<string> jsonFileNames = new HashSet<string>();
|
||||||
|
|
||||||
|
foreach (string jsonFile in jsonFiles)
|
||||||
|
{
|
||||||
|
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(jsonFile);
|
||||||
|
jsonFileNames.Add(fileNameWithoutExtension);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取 images 文件夹中的所有图片文件
|
||||||
|
string[] imageFiles = Directory.GetFiles(imagesFolderPath);
|
||||||
|
|
||||||
|
// 遍历图片文件,检查是否有对应的 JSON 文件
|
||||||
|
foreach (string imageFile in imageFiles)
|
||||||
|
{
|
||||||
|
string imageFileNameWithoutExtension = Path.GetFileNameWithoutExtension(imageFile);
|
||||||
|
|
||||||
|
// 如果图片文件名不在 labels 文件夹的 JSON 文件名集合中,则删除该图片
|
||||||
|
if (!jsonFileNames.Contains(imageFileNameWithoutExtension))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Delete(imageFile); // 删除图片
|
||||||
|
Console.WriteLine($"已删除图片: {Path.GetFileName(imageFile)}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"删除文件 {Path.GetFileName(imageFile)} 时出错: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine($"图片 {Path.GetFileName(imageFile)} 有对应的 JSON 文件,不删除。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"操作失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 将 List<string> 保存到指定文件中,格式为 "项,标签"。
|
||||||
|
/// 标签是根据项的索引生成的。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="items">要保存的字符串列表</param>
|
||||||
|
/// <param name="filePath">保存文件的路径</param>
|
||||||
|
public static void SaveItemsToFile(List<string> items, string filePath)
|
||||||
|
{
|
||||||
|
// 使用 StreamWriter 写入文件
|
||||||
|
using (StreamWriter writer = new StreamWriter(filePath))
|
||||||
|
{
|
||||||
|
// 遍历 items 列表
|
||||||
|
for (int i = 0; i < items.Count; i++)
|
||||||
|
{
|
||||||
|
// 写入每一行,格式为 "项, 标签"
|
||||||
|
writer.WriteLine($"{items[i]},{i}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void SaveItemsToFile(HashSet<string> items, string filePath)
|
||||||
|
{
|
||||||
|
// 使用 StreamWriter 写入文件
|
||||||
|
using (StreamWriter writer = new StreamWriter(filePath))
|
||||||
|
{
|
||||||
|
// 遍历 HashSet
|
||||||
|
int i = 0;
|
||||||
|
foreach (string item in items)
|
||||||
|
{
|
||||||
|
// 写入每一行,格式为 "项, 标签"
|
||||||
|
writer.WriteLine($"{item},{i}"); // 假设使用 item 的长度作为标签
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static List<FileInformation> FileList = new List<FileInformation>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 递归获取指定文件夹下所有文件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dir"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static List<FileInformation> GetAllFiles(DirectoryInfo dir)
|
||||||
|
{
|
||||||
|
FileInfo[] allFile = dir.GetFiles();
|
||||||
|
foreach (FileInfo fi in allFile)
|
||||||
|
{
|
||||||
|
FileList.Add(new FileInformation { FileName = fi.Name, FilePath = fi.FullName });
|
||||||
|
}
|
||||||
|
DirectoryInfo[] allDir = dir.GetDirectories();
|
||||||
|
foreach (DirectoryInfo d in allDir)
|
||||||
|
{
|
||||||
|
GetAllFiles(d);
|
||||||
|
}
|
||||||
|
return FileList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 判断字符串是否纯字母
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsAlphabetOnly(string input)
|
||||||
|
{
|
||||||
|
return Regex.IsMatch(input, "^[a-zA-Z]+$");
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 判断字符串是否仅包含大小写字母和数字
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input">待判断的字符串</param>
|
||||||
|
/// <returns>如果字符串仅包含字母和数字,返回 true;否则返回 false</returns>
|
||||||
|
public static bool IsAlphaNumericOnly(string input)
|
||||||
|
{
|
||||||
|
return Regex.IsMatch(input, "^[a-zA-Z0-9]+$");
|
||||||
|
}
|
||||||
|
public static string ConvertHanzitoPinyinWithNumbers(string input)
|
||||||
|
{
|
||||||
|
// 正则表达式匹配汉字
|
||||||
|
string pattern = @"[\u4e00-\u9fa5]";
|
||||||
|
Regex regex = new Regex(pattern);
|
||||||
|
|
||||||
|
StringBuilder result = new StringBuilder();
|
||||||
|
int lastIndex = 0;
|
||||||
|
|
||||||
|
foreach (Match match in regex.Matches(input))
|
||||||
|
{
|
||||||
|
// 将非汉字部分保留为原样
|
||||||
|
result.Append(input.Substring(lastIndex, match.Index - lastIndex));
|
||||||
|
|
||||||
|
// 获取汉字并转换为拼音
|
||||||
|
string hanzi = match.Value;
|
||||||
|
string pinyin = ConvertHanziToPinyin(hanzi);
|
||||||
|
|
||||||
|
// 将拼音追加到结果中
|
||||||
|
result.Append(pinyin);
|
||||||
|
|
||||||
|
lastIndex = match.Index + match.Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加最后的非汉字部分
|
||||||
|
result.Append(input.Substring(lastIndex));
|
||||||
|
|
||||||
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ConvertHanziToPinyin(string hanzi)
|
||||||
|
{
|
||||||
|
// 设置拼音格式:去掉音调,拼音小写,ü保持为u:
|
||||||
|
PinyinFormat format = PinyinFormat.WITHOUT_TONE | PinyinFormat.LOWERCASE | PinyinFormat.WITH_U_AND_COLON;
|
||||||
|
|
||||||
|
// 获取拼音数组
|
||||||
|
List<PinyinItem> pinyinItems = Pinyin4Net.GetPinyinArray(hanzi, format);
|
||||||
|
|
||||||
|
StringBuilder pinyinBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
foreach (var item in pinyinItems)
|
||||||
|
{
|
||||||
|
// 处理多音字:默认取第一个拼音
|
||||||
|
if (item.Count > 0)
|
||||||
|
{
|
||||||
|
string pinyin = item[0];
|
||||||
|
|
||||||
|
// 特殊处理ü的情况
|
||||||
|
pinyin = pinyin.Replace("u:", "v"); // 将u:转为v,这是常见的拼音表示法
|
||||||
|
|
||||||
|
pinyinBuilder.Append(pinyin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pinyinBuilder.ToString();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 汉字拼音转化
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hanzi"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
//public static string ConvertHanzitoPinyin(string hanzi)
|
||||||
|
//{
|
||||||
|
// PinyinFormat format = PinyinFormat.WITHOUT_TONE | PinyinFormat.LOWERCASE | PinyinFormat.WITH_U_UNICODE;
|
||||||
|
|
||||||
|
// // string hanzi = defectRow.LabelDescription;
|
||||||
|
// List<PinyinItem> pylist = Pinyin4Net.GetPinyinArray(hanzi, format);
|
||||||
|
// // 提取所有拼音并合并为一个字符串
|
||||||
|
// List<string> pinyinStrings = new List<string>();
|
||||||
|
// foreach (var item in pylist)
|
||||||
|
// {
|
||||||
|
// // 将PinyinItem中的每个拼音(List<string>)合并为一个字符串
|
||||||
|
// string joinedPinyin = string.Join("", item); // 这里的item就是一个List<string>,其中存储了拼音
|
||||||
|
// pinyinStrings.Add(joinedPinyin); // 添加合并后的拼音
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 合并所有拼音为一个字符串
|
||||||
|
// string allPinyin = string.Join("", pinyinStrings);
|
||||||
|
// return allPinyin;
|
||||||
|
//}
|
||||||
|
/// <summary>
|
||||||
|
/// 递归获取指定文件夹下所有文件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dir"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static List<FileInformation> GetAllFiles(string dir)
|
||||||
|
{
|
||||||
|
DirectoryInfo directoryInfo = new(dir);
|
||||||
|
return GetAllFiles(directoryInfo);
|
||||||
|
}
|
||||||
|
public static string OpenSlectDirDialog(string dirpath = "")
|
||||||
|
{
|
||||||
|
FolderBrowserDialog fbd = new FolderBrowserDialog();
|
||||||
|
fbd.InitialDirectory = dirpath;
|
||||||
|
if (fbd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
string targetDirPath = fbd.SelectedPath;
|
||||||
|
if (Directory.Exists(targetDirPath))
|
||||||
|
{
|
||||||
|
return targetDirPath;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return string.Empty;
|
||||||
|
//ImportDirImages(targetDirPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
public static string OpenSlectfileDialog(string dirpath = "")
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 创建并配置 OpenFileDialog 实例
|
||||||
|
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||||
|
openFileDialog.Title = "选择文件"; // 对话框标题
|
||||||
|
openFileDialog.Filter = "所有文件 (*.pt)|*.*"; // 允许选择任何类型的文件
|
||||||
|
openFileDialog.InitialDirectory = @"C:\"; // 初始显示目录,可以根据需要修改
|
||||||
|
|
||||||
|
// 显示对话框
|
||||||
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
// 获取选中的文件路径
|
||||||
|
string selectedFilePath = openFileDialog.FileName;
|
||||||
|
Console.WriteLine("您选择的文件路径是: " + selectedFilePath);
|
||||||
|
return selectedFilePath;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("没有选择任何文件。");
|
||||||
|
return string.Empty;
|
||||||
|
MessageBox.Show("没有选择任何文件。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FileInformation
|
||||||
|
{
|
||||||
|
public string FileName { get; set; }
|
||||||
|
public string FilePath { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -24,7 +24,7 @@ namespace DH.Devices.Camera
|
|||||||
private dvpStatus nRet = dvpStatus.DVP_STATUS_OK;
|
private dvpStatus nRet = dvpStatus.DVP_STATUS_OK;
|
||||||
private DVPCamera.dvpEventCallback pCallBackFunc;
|
private DVPCamera.dvpEventCallback pCallBackFunc;
|
||||||
private uint m_handle;
|
private uint m_handle;
|
||||||
|
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;
|
||||||
@@ -180,13 +180,14 @@ namespace DH.Devices.Camera
|
|||||||
|
|
||||||
//IIConfig.PropertyChanged -= IIConfig_PropertyChanged;
|
//IIConfig.PropertyChanged -= IIConfig_PropertyChanged;
|
||||||
//IIConfig.PropertyChanged += IIConfig_PropertyChanged;
|
//IIConfig.PropertyChanged += IIConfig_PropertyChanged;
|
||||||
|
Connected = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
Connected = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -76,7 +76,8 @@ namespace DH.Devices.PLC
|
|||||||
{
|
{
|
||||||
Connected = false;
|
Connected = false;
|
||||||
LogAsync(DateTime.Now, LogLevel.Error, $"PLC初始化失败");
|
LogAsync(DateTime.Now, LogLevel.Error, $"PLC初始化失败");
|
||||||
throw new Exception($"{IP}:{Port}PLC连接失败!");
|
return false;
|
||||||
|
//throw new Exception($"{IP}:{Port}PLC连接失败!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -85,7 +86,8 @@ namespace DH.Devices.PLC
|
|||||||
{
|
{
|
||||||
Connected = false;
|
Connected = false;
|
||||||
LogAsync(DateTime.Now, LogLevel.Error, $"{IP}:{Port}PLC连接失败!失败原因:{ex.ToString()}");
|
LogAsync(DateTime.Now, LogLevel.Error, $"{IP}:{Port}PLC连接失败!失败原因:{ex.ToString()}");
|
||||||
throw new Exception($"{IP}:{Port}PLC连接失败!失败原因:{ex.ToString()}");
|
return false;
|
||||||
|
//throw new Exception($"{IP}:{Port}PLC连接失败!失败原因:{ex.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -36,8 +36,11 @@ using System.Windows.Forms;
|
|||||||
using XKRS.UI.Device.Winform;
|
using XKRS.UI.Device.Winform;
|
||||||
using static AntdUI.Math3D;
|
using static AntdUI.Math3D;
|
||||||
using static DH.Commons.Enums.EnumHelper;
|
using static DH.Commons.Enums.EnumHelper;
|
||||||
|
using Button = System.Windows.Forms.Button;
|
||||||
using Camera = DHSoftware.Models.Camera;
|
using Camera = DHSoftware.Models.Camera;
|
||||||
|
using Label = AntdUI.Label;
|
||||||
using LogLevel = DH.Commons.Enums.EnumHelper.LogLevel;
|
using LogLevel = DH.Commons.Enums.EnumHelper.LogLevel;
|
||||||
|
using Point = System.Drawing.Point;
|
||||||
using ResultState = DH.Commons.Base.ResultState;
|
using ResultState = DH.Commons.Base.ResultState;
|
||||||
using Timer = System.Threading.Timer;
|
using Timer = System.Threading.Timer;
|
||||||
|
|
||||||
@@ -189,7 +192,15 @@ namespace DHSoftware
|
|||||||
SetPermission(list, this.Controls);
|
SetPermission(list, this.Controls);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void ResetAllCameraCounts()
|
||||||
|
{
|
||||||
|
CameraSummaries.ForEach(camera =>
|
||||||
|
{
|
||||||
|
camera.OKCount = 0;
|
||||||
|
camera.NGCount = 0;
|
||||||
|
camera.TiggerCount = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
private void SetPermission(List<SysPermission> list, Control.ControlCollection controls)
|
private void SetPermission(List<SysPermission> list, Control.ControlCollection controls)
|
||||||
{
|
{
|
||||||
foreach (Control control in controls)
|
foreach (Control control in controls)
|
||||||
@@ -689,8 +700,27 @@ namespace DHSoftware
|
|||||||
{
|
{
|
||||||
cam.OnLog -= _visionEngine_OnLog;
|
cam.OnLog -= _visionEngine_OnLog;
|
||||||
cam.OnLog += _visionEngine_OnLog;
|
cam.OnLog += _visionEngine_OnLog;
|
||||||
cam.CameraConnect();
|
|
||||||
cam.OnHImageOutput += OnCameraHImageOutput;
|
cam.OnHImageOutput += OnCameraHImageOutput;
|
||||||
|
|
||||||
|
Button CamLabel = new Button();
|
||||||
|
CamLabel.Name = cameraBase.CameraName;
|
||||||
|
CamLabel.Text = cameraBase.CameraName; // 关键1:必须有文本
|
||||||
|
CamLabel.AutoSize = true;
|
||||||
|
CamLabel.Size = new System.Drawing.Size(20, 20); // 关键2:自动调整大小
|
||||||
|
CamLabel.Location = new Point(20 + 50 * i, 12); // 关键3:明确位置
|
||||||
|
if (cam.CameraConnect())
|
||||||
|
CamLabel.BackColor = Color.Green; // 关键4:避免透明
|
||||||
|
else
|
||||||
|
CamLabel.BackColor = Color.Yellow; // 关键4:避免透明
|
||||||
|
CamLabel.ForeColor = Color.Black; // 关键4:避免透明
|
||||||
|
CamLabel.Font = new Font("Microsoft YaHei", 9); // 可选:字体
|
||||||
|
|
||||||
|
// 关键5:确保添加到父控件
|
||||||
|
if (pageHeader1 != null && !pageHeader1.Controls.Contains(CamLabel))
|
||||||
|
{
|
||||||
|
pageHeader1.Controls.Add(CamLabel);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -707,7 +737,7 @@ namespace DHSoftware
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ConnectPLC()
|
public void ConnectPLC()
|
||||||
{
|
{
|
||||||
if (ConfigModel.PLCBaseList.Count > 0)
|
if (ConfigModel.PLCBaseList.Count > 0)
|
||||||
@@ -725,7 +755,31 @@ namespace DHSoftware
|
|||||||
PLC.Port = plcBase.Port;
|
PLC.Port = plcBase.Port;
|
||||||
PLC.OnLog -= _visionEngine_OnLog;
|
PLC.OnLog -= _visionEngine_OnLog;
|
||||||
PLC.OnLog += _visionEngine_OnLog;
|
PLC.OnLog += _visionEngine_OnLog;
|
||||||
PLC.PLCConnect();
|
if(PLC.Enable)
|
||||||
|
{
|
||||||
|
PLC.PLCConnect();
|
||||||
|
Button CamLabel = new Button();
|
||||||
|
CamLabel.Name = PLC.PLCName;
|
||||||
|
CamLabel.Text = PLC.PLCName; // 关键1:必须有文本
|
||||||
|
CamLabel.AutoSize = true;
|
||||||
|
CamLabel.Size = new System.Drawing.Size(20, 20); // 关键2:自动调整大小
|
||||||
|
CamLabel.Location = new Point(20 + 50 * (i + ConfigModel.CameraBaseList.Count), 12); // 关键3:明确位置
|
||||||
|
if (PLC.Connected)
|
||||||
|
CamLabel.BackColor = Color.Green; // 关键4:避免透明
|
||||||
|
else
|
||||||
|
CamLabel.BackColor = Color.Yellow; // 关键4:避免透明
|
||||||
|
CamLabel.ForeColor = Color.Black; // 关键4:避免透明
|
||||||
|
//CamLabel.ForeColor = Color.Green; // 关键4:避免透明
|
||||||
|
CamLabel.Font = new Font("Microsoft YaHei", 9); // 可选:字体
|
||||||
|
|
||||||
|
// 关键5:确保添加到父控件
|
||||||
|
if (pageHeader1 != null && !pageHeader1.Controls.Contains(CamLabel))
|
||||||
|
{
|
||||||
|
pageHeader1.Controls.Add(CamLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1146,10 +1200,13 @@ namespace DHSoftware
|
|||||||
// DataSavePath = string.IsNullOrEmpty(DataSavePath) ? Path.Combine(X018PLCConfig.ImgDirectory, DateTime.Now.ToString("yyyyMMdd"), BatchNO) : DataSavePath;
|
// DataSavePath = string.IsNullOrEmpty(DataSavePath) ? Path.Combine(X018PLCConfig.ImgDirectory, DateTime.Now.ToString("yyyyMMdd"), BatchNO) : DataSavePath;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleStartButton()
|
private void HandleStartButton()
|
||||||
{
|
{
|
||||||
InitialCameraSumsView();
|
InitialCameraSumsView();
|
||||||
LogAsync(DateTime.Now, LogLevel.Information, "流程启动中,请稍候...");
|
LogAsync(DateTime.Now, LogLevel.Information, "流程启动中,请稍候...");
|
||||||
|
ResetAllCameraCounts();
|
||||||
|
//开始流程
|
||||||
StartProcess();
|
StartProcess();
|
||||||
LogAsync(DateTime.Now, LogLevel.Action, "流程启动完成!");
|
LogAsync(DateTime.Now, LogLevel.Action, "流程启动完成!");
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
@@ -8,7 +8,7 @@ namespace AntdUIDemo.Views.Table
|
|||||||
{
|
{
|
||||||
public partial class DefectRowEdit : UserControl
|
public partial class DefectRowEdit : UserControl
|
||||||
{
|
{
|
||||||
DetectConfigControl detectConfigControl;
|
//DetectConfigControl detectConfigControl;
|
||||||
private AntdUI.Window window;
|
private AntdUI.Window window;
|
||||||
private DefectRow user;
|
private DefectRow user;
|
||||||
public bool submit;
|
public bool submit;
|
||||||
|
297
DHSoftware/Views/DetectConfigControl.Designer.cs
generated
297
DHSoftware/Views/DetectConfigControl.Designer.cs
generated
@@ -1,297 +0,0 @@
|
|||||||
namespace DHSoftware.Views
|
|
||||||
{
|
|
||||||
partial class DetectConfigControl
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
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 AntdUI.Label();
|
|
||||||
buttonDEL = new AntdUI.Button();
|
|
||||||
table_base = new AntdUI.Table();
|
|
||||||
buttonADD = new AntdUI.Button();
|
|
||||||
panel1.SuspendLayout();
|
|
||||||
panel3.SuspendLayout();
|
|
||||||
panel2.SuspendLayout();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
panel1.Controls.Add(panel3);
|
|
||||||
panel1.Controls.Add(panel2);
|
|
||||||
panel1.Dock = DockStyle.Fill;
|
|
||||||
panel1.Location = new Point(0, 0);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
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.Right;
|
|
||||||
button3.Location = new Point(385, 73);
|
|
||||||
button3.Name = "button3";
|
|
||||||
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.Controls.Add(label2);
|
|
||||||
panel2.Controls.Add(buttonDEL);
|
|
||||||
panel2.Controls.Add(table_base);
|
|
||||||
panel2.Controls.Add(buttonADD);
|
|
||||||
panel2.Dock = DockStyle.Bottom;
|
|
||||||
panel2.Location = new Point(0, 206);
|
|
||||||
panel2.Name = "panel2";
|
|
||||||
panel2.Size = new Size(598, 237);
|
|
||||||
panel2.TabIndex = 35;
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.Location = new Point(3, 3);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(58, 23);
|
|
||||||
label2.TabIndex = 29;
|
|
||||||
label2.Text = "模型参数";
|
|
||||||
//
|
|
||||||
// buttonDEL
|
|
||||||
//
|
|
||||||
buttonDEL.Location = new Point(93, 28);
|
|
||||||
buttonDEL.Name = "buttonDEL";
|
|
||||||
buttonDEL.Size = new Size(84, 34);
|
|
||||||
buttonDEL.TabIndex = 24;
|
|
||||||
buttonDEL.Text = "删除";
|
|
||||||
//
|
|
||||||
// table_base
|
|
||||||
//
|
|
||||||
table_base.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
table_base.Location = new Point(0, 68);
|
|
||||||
table_base.Name = "table_base";
|
|
||||||
table_base.Size = new Size(598, 169);
|
|
||||||
table_base.TabIndex = 22;
|
|
||||||
table_base.Text = "table1";
|
|
||||||
//
|
|
||||||
// buttonADD
|
|
||||||
//
|
|
||||||
buttonADD.Location = new Point(3, 28);
|
|
||||||
buttonADD.Name = "buttonADD";
|
|
||||||
buttonADD.Size = new Size(84, 34);
|
|
||||||
buttonADD.TabIndex = 23;
|
|
||||||
buttonADD.Text = "新增";
|
|
||||||
//
|
|
||||||
// DetectConfigControl
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
Controls.Add(panel1);
|
|
||||||
Name = "DetectConfigControl";
|
|
||||||
Size = new Size(600, 445);
|
|
||||||
panel1.ResumeLayout(false);
|
|
||||||
panel3.ResumeLayout(false);
|
|
||||||
panel2.ResumeLayout(false);
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel1;
|
|
||||||
private AntdUI.Label label1;
|
|
||||||
private AntdUI.Label label6;
|
|
||||||
private AntdUI.Button btnPreOpen;
|
|
||||||
private AntdUI.Label label7;
|
|
||||||
private AntdUI.Switch sthPic;
|
|
||||||
private AntdUI.Label label8;
|
|
||||||
private AntdUI.Switch switchEnable;
|
|
||||||
private AntdUI.Label label10;
|
|
||||||
private AntdUI.Switch sthSaveNGPic;
|
|
||||||
private AntdUI.Label label9;
|
|
||||||
private AntdUI.Switch swSaveOKPic;
|
|
||||||
private Panel panel2;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,403 +0,0 @@
|
|||||||
using AntdUI;
|
|
||||||
using AntdUIDemo.Views.Table;
|
|
||||||
using DH.Commons.Enums;
|
|
||||||
using DH.Devices.Vision;
|
|
||||||
using DHSoftware.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Data.Common;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using DH.Devices.Vision;
|
|
||||||
using DH.Commons.Base;
|
|
||||||
|
|
||||||
namespace DHSoftware.Views
|
|
||||||
{
|
|
||||||
public partial class DetectConfigControl : UserControl
|
|
||||||
{
|
|
||||||
|
|
||||||
private DetectionConfig _currentConfig = new DetectionConfig();
|
|
||||||
private readonly string _configName;
|
|
||||||
List<KeyValuePair<string, int>> MLModelTypes = GetFilteredEnumDescriptionsAndValues<ModelType>();
|
|
||||||
|
|
||||||
public static List<KeyValuePair<string, int>> GetFilteredEnumDescriptionsAndValues<T>() where T : Enum
|
|
||||||
{
|
|
||||||
return Enum.GetValues(typeof(T))
|
|
||||||
.Cast<T>()
|
|
||||||
.Select(e =>
|
|
||||||
{
|
|
||||||
// 获取枚举的 Description 属性,如果没有,则使用枚举的名称
|
|
||||||
var description = e.GetType()
|
|
||||||
.GetField(e.ToString())
|
|
||||||
?.GetCustomAttribute<DescriptionAttribute>()
|
|
||||||
?.Description ?? e.ToString();
|
|
||||||
|
|
||||||
// 返回枚举的描述和对应的整数值
|
|
||||||
return new KeyValuePair<string, int>(description, Convert.ToInt32(e));
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<KeyValuePair<string, int>> resultStates = GetFilteredEnumDescriptionsAndValues<ResultState>();
|
|
||||||
// 获取枚举的描述和对应的值,只筛选出 OK 和 NG
|
|
||||||
public static List<KeyValuePair<string, int>> GetFilteredEnumDescriptionsAndValuesres<T>() where T : Enum
|
|
||||||
{
|
|
||||||
return Enum.GetValues(typeof(T))
|
|
||||||
.Cast<T>()
|
|
||||||
.Where(e => e.Equals(ResultState.OK) || e.Equals(ResultState.DetectNG)) // 只保留 OK 和 NG
|
|
||||||
.Select(e =>
|
|
||||||
{
|
|
||||||
// 通过反射获取 DescriptionAttribute 描述,如果没有描述,则使用枚举项名称
|
|
||||||
var description = e.GetType()
|
|
||||||
.GetField(e.ToString())
|
|
||||||
?.GetCustomAttribute<DescriptionAttribute>()
|
|
||||||
?.Description ?? e.ToString(); // 如果没有 DescriptionAttribute,则使用枚举名称
|
|
||||||
|
|
||||||
// 返回描述和值的键值对
|
|
||||||
return new KeyValuePair<string, int>(description, Convert.ToInt32(e));
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DetectionConfig Detection = new DetectionConfig();
|
|
||||||
AntList<DefectRow> antList;
|
|
||||||
public AntdUI.Window _window;
|
|
||||||
DefectRow curUser;
|
|
||||||
public DetectConfigControl()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
InitTableColumns();
|
|
||||||
//InitData();
|
|
||||||
BindEventHandler();
|
|
||||||
foreach (var item in MLModelTypes)
|
|
||||||
{
|
|
||||||
cbxDetectType.Items.Add(item.Key);
|
|
||||||
}
|
|
||||||
cbxDetectType.SelectedIndex = (int)Detection.ModelType - 1;
|
|
||||||
tbDetectName.Text = Detection.Name;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitTableColumns()
|
|
||||||
{
|
|
||||||
table_base.Columns = new ColumnCollection() {
|
|
||||||
new ColumnCheck("Selected"){Fixed = true},
|
|
||||||
new Column("LabelDescription", "标签名", ColumnAlign.Center)
|
|
||||||
{
|
|
||||||
Width="120",
|
|
||||||
//设置树节点,名称需和User里的User[]名称保持一致
|
|
||||||
KeyTree = "Users"
|
|
||||||
},
|
|
||||||
new ColumnSwitch("IsEnable", "是否启用", ColumnAlign.Center){
|
|
||||||
//支持点击回调
|
|
||||||
//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),
|
|
||||||
|
|
||||||
new Column("AreaMinValue", "最小面积",ColumnAlign.Center),
|
|
||||||
new Column("AreaMaxValue", "最大面积",ColumnAlign.Center),
|
|
||||||
//new Column("CellBadge", "徽标",ColumnAlign.Center),
|
|
||||||
//new Column("CellText", "富文本")
|
|
||||||
//{
|
|
||||||
// ColAlign = ColumnAlign.Center,//支持表头位置单独设置
|
|
||||||
//},
|
|
||||||
//new Column("CellProgress", "进度条",ColumnAlign.Center),
|
|
||||||
//new Column("CellDivider", "分割线",ColumnAlign.Center),
|
|
||||||
//new Column("CellLinks", "链接", ColumnAlign.Center)
|
|
||||||
//{
|
|
||||||
// Fixed = true,//冻结列
|
|
||||||
//},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitData()
|
|
||||||
{
|
|
||||||
antList = new AntList<DefectRow>();
|
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
{
|
|
||||||
antList.Add(new DefectRow
|
|
||||||
{
|
|
||||||
LabelDescription = "张三",
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
table_base.Binding(antList);
|
|
||||||
|
|
||||||
//设置行禁用
|
|
||||||
// table_base.SetRowEnable(0, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void BindEventHandler()
|
|
||||||
{
|
|
||||||
buttonADD.Click += ButtonADD_Click;
|
|
||||||
buttonDEL.Click += ButtonDEL_Click;
|
|
||||||
|
|
||||||
|
|
||||||
table_base.CellClick += Table_base_CellClick;
|
|
||||||
table_base.CellButtonClick += Table_base_CellButtonClick;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private AntdUI.Table.CellStyleInfo Table_base_SetRowStyle(object sender, TableSetRowStyleEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.RowIndex % 2 == 0)
|
|
||||||
{
|
|
||||||
return new AntdUI.Table.CellStyleInfo
|
|
||||||
{
|
|
||||||
BackColor = AntdUI.Style.Db.ErrorBg,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonADD_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DefectRow useradd = new DefectRow()
|
|
||||||
{
|
|
||||||
LabelDescription="xinquexian",
|
|
||||||
IsEnable=true,
|
|
||||||
ScoreMinValue=0.3,
|
|
||||||
ScoreMaxValue=1,
|
|
||||||
AreaMinValue=1,
|
|
||||||
AreaMaxValue=999999999,
|
|
||||||
|
|
||||||
};
|
|
||||||
var form = new DefectRowEdit(_window, useradd) { Size = new Size(700, 500) };
|
|
||||||
AntdUI.Modal.open(new AntdUI.Modal.Config(_window, "", form, TType.None)
|
|
||||||
{
|
|
||||||
BtnHeight = 0,
|
|
||||||
});
|
|
||||||
if (form.submit)
|
|
||||||
{
|
|
||||||
antList.Add(useradd);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Table_base_CellClick(object sender, TableClickEventArgs e)
|
|
||||||
{
|
|
||||||
var record = e.Record;
|
|
||||||
if (record is DefectRow user)
|
|
||||||
{
|
|
||||||
curUser = user;
|
|
||||||
//判断是否右键
|
|
||||||
if (e.Button == MouseButtons.Right)
|
|
||||||
{
|
|
||||||
if (antList.Count == 0) return;
|
|
||||||
AntdUI.ContextMenuStrip.open(new AntdUI.ContextMenuStrip.Config(table_base,
|
|
||||||
(item) =>
|
|
||||||
{
|
|
||||||
if (item.Text == "开启")
|
|
||||||
{
|
|
||||||
user.IsEnable = true;
|
|
||||||
}
|
|
||||||
else if (item.Text == "关闭")
|
|
||||||
{
|
|
||||||
user.IsEnable = false;
|
|
||||||
}
|
|
||||||
else if (item.Text == "编辑")
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (item.Text == "删除")
|
|
||||||
{
|
|
||||||
var result = Modal.open(_window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
|
||||||
if (result == DialogResult.OK)
|
|
||||||
{
|
|
||||||
//父元素没有勾选或者子元素也没有勾选,则删除当前行
|
|
||||||
bool delCurrent = !antList.Any(x => x.Selected /*|| (x.?.Any(u => u.Selected) ?? false)*/);
|
|
||||||
|
|
||||||
if (delCurrent)
|
|
||||||
{
|
|
||||||
//删除当前行,先判断是否父元素,再判断是否子元素,只支持一层子元素,需实现嵌套查询
|
|
||||||
for (int i = 0; i < antList.Count; i++)
|
|
||||||
{
|
|
||||||
if (antList[i] == user)
|
|
||||||
{
|
|
||||||
antList.RemoveAt(i);
|
|
||||||
}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// antList[i].Users = antList[i].Users?.Where(x => x != user).ToArray();
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 使用反转for循环删除主列表中选中的项
|
|
||||||
for (int i = antList.Count - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
// 1.删除选中的主列表项
|
|
||||||
if (antList[i].Selected)
|
|
||||||
{
|
|
||||||
antList.RemoveAt(i);
|
|
||||||
}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// // 删除子列表中选中的项
|
|
||||||
// antList[i].Users = antList[i].Users?.Where(childUser => !childUser.Selected).ToArray();
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (item.Text == "查看图片")
|
|
||||||
{
|
|
||||||
//查看其他来源的高清图片
|
|
||||||
Preview.open(new Preview.Config(_window, Properties.Resources.head2));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
AntdUI.Message.info(_window, item.Text, autoClose: 1);
|
|
||||||
},
|
|
||||||
new IContextMenuStripItem[] {
|
|
||||||
//根据行数据动态修改右键菜单
|
|
||||||
user.IsEnable? new ContextMenuStripItem("关闭")
|
|
||||||
{
|
|
||||||
IconSvg = "CloseOutlined"
|
|
||||||
}:new ContextMenuStripItem("开启")
|
|
||||||
{
|
|
||||||
IconSvg = "CheckOutlined"
|
|
||||||
},
|
|
||||||
new AntdUI.ContextMenuStripItem("编辑"){
|
|
||||||
IconSvg = "EditOutlined",
|
|
||||||
},
|
|
||||||
new AntdUI.ContextMenuStripItem("删除"){
|
|
||||||
IconSvg = "DeleteOutlined"
|
|
||||||
},
|
|
||||||
new ContextMenuStripItem("查看图片")
|
|
||||||
{
|
|
||||||
IconSvg = "FundViewOutlined"
|
|
||||||
},
|
|
||||||
new ContextMenuStripItemDivider(),
|
|
||||||
new AntdUI.ContextMenuStripItem("详情"){
|
|
||||||
Sub = new IContextMenuStripItem[]{ new AntdUI.ContextMenuStripItem("打印", "Ctrl + P") { },
|
|
||||||
new AntdUI.ContextMenuStripItem("另存为", "Ctrl + S") { } },
|
|
||||||
IconSvg = "<svg t=\"1725101601993\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"1414\" width=\"200\" height=\"200\"><path d=\"M450.23 831.7c-164.87 0-316.85-108.51-366.94-269.68-30.4-97.82-20.9-201.62 26.76-292.29s127.79-157.35 225.6-187.75c97.83-30.42 201.61-20.9 292.29 26.76 90.67 47.67 157.35 127.79 187.75 225.61 35.78 115.12 16.24 237.58-53.6 335.99a383.494 383.494 0 0 1-43 50.66c-15.04 14.89-39.34 14.78-54.23-0.29-14.9-15.05-14.77-39.34 0.29-54.23a307.844 307.844 0 0 0 34.39-40.52c55.9-78.76 71.54-176.75 42.92-268.84-50.21-161.54-222.49-252.1-384.03-201.9-78.26 24.32-142.35 77.67-180.48 150.2-38.14 72.53-45.74 155.57-21.42 233.83 44.58 143.44 190.03 234.7 338.26 212.42 20.98-3.14 40.48 11.26 43.64 32.2 3.16 20.95-11.26 40.48-32.2 43.64a377.753 377.753 0 0 1-56 4.19z\" p-id=\"1415\"></path><path d=\"M919.84 959.5c-9.81 0-19.63-3.74-27.11-11.24L666.75 722.29c-14.98-14.97-14.98-39.25 0-54.23 14.97-14.98 39.26-14.98 54.23 0l225.97 225.97c14.98 14.97 14.98 39.25 0 54.23-7.48 7.5-17.3 11.24-27.11 11.24z\" p-id=\"1416\"></path></svg>",
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//表格内部按钮事件
|
|
||||||
private void Table_base_CellButtonClick(object sender, TableButtonEventArgs e)
|
|
||||||
{
|
|
||||||
var buttontext = e.Btn.Text;
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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("删除成功!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
5
DHSoftware/Views/DetectControl.Designer.cs
generated
5
DHSoftware/Views/DetectControl.Designer.cs
generated
@@ -95,6 +95,7 @@
|
|||||||
tabs1.Pages.Add(tabPage1);
|
tabs1.Pages.Add(tabPage1);
|
||||||
tabs1.Pages.Add(tabPage2);
|
tabs1.Pages.Add(tabPage2);
|
||||||
tabs1.Pages.Add(tabPage3);
|
tabs1.Pages.Add(tabPage3);
|
||||||
|
tabs1.SelectedIndex = 1;
|
||||||
tabs1.Size = new Size(915, 609);
|
tabs1.Size = new Size(915, 609);
|
||||||
tabs1.Style = styleLine1;
|
tabs1.Style = styleLine1;
|
||||||
tabs1.TabIndex = 1;
|
tabs1.TabIndex = 1;
|
||||||
@@ -115,7 +116,7 @@
|
|||||||
tabPage1.Controls.Add(label2);
|
tabPage1.Controls.Add(label2);
|
||||||
tabPage1.Controls.Add(iptPrePath);
|
tabPage1.Controls.Add(iptPrePath);
|
||||||
tabPage1.Controls.Add(label1);
|
tabPage1.Controls.Add(label1);
|
||||||
tabPage1.Location = new Point(3, 31);
|
tabPage1.Location = new Point(-909, -575);
|
||||||
tabPage1.Name = "tabPage1";
|
tabPage1.Name = "tabPage1";
|
||||||
tabPage1.Size = new Size(909, 575);
|
tabPage1.Size = new Size(909, 575);
|
||||||
tabPage1.TabIndex = 0;
|
tabPage1.TabIndex = 0;
|
||||||
@@ -285,7 +286,7 @@
|
|||||||
tabPage2.Controls.Add(label7);
|
tabPage2.Controls.Add(label7);
|
||||||
tabPage2.Controls.Add(iptDetectPath);
|
tabPage2.Controls.Add(iptDetectPath);
|
||||||
tabPage2.Controls.Add(label8);
|
tabPage2.Controls.Add(label8);
|
||||||
tabPage2.Location = new Point(-909, -575);
|
tabPage2.Location = new Point(3, 31);
|
||||||
tabPage2.Name = "tabPage2";
|
tabPage2.Name = "tabPage2";
|
||||||
tabPage2.Size = new Size(909, 575);
|
tabPage2.Size = new Size(909, 575);
|
||||||
tabPage2.TabIndex = 1;
|
tabPage2.TabIndex = 1;
|
||||||
|
@@ -15,7 +15,7 @@ namespace DHSoftware.Views
|
|||||||
{
|
{
|
||||||
Window window;
|
Window window;
|
||||||
DetectionConfig detectionConfig;
|
DetectionConfig detectionConfig;
|
||||||
public DetectControl(Window _window,DetectionConfig _detection)
|
public DetectControl(Window _window, DetectionConfig _detection)
|
||||||
{
|
{
|
||||||
window = _window;
|
window = _window;
|
||||||
detectionConfig = _detection;
|
detectionConfig = _detection;
|
||||||
@@ -230,7 +230,7 @@ namespace DHSoftware.Views
|
|||||||
//CellBadge = new CellBadge(SizeEnum.Circle.GetEnumDescription()),
|
//CellBadge = new CellBadge(SizeEnum.Circle.GetEnumDescription()),
|
||||||
CellLinks = new CellLink[] {
|
CellLinks = new CellLink[] {
|
||||||
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
|
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
|
||||||
|
|
||||||
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
|
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
|
||||||
new CellButton(Guid.NewGuid().ToString(),"进行测量",TTypeMini.Primary)
|
new CellButton(Guid.NewGuid().ToString(),"进行测量",TTypeMini.Primary)
|
||||||
}
|
}
|
||||||
@@ -387,7 +387,7 @@ namespace DHSoftware.Views
|
|||||||
{
|
{
|
||||||
PreTreatParam preParam = new PreTreatParam()
|
PreTreatParam preParam = new PreTreatParam()
|
||||||
{
|
{
|
||||||
|
|
||||||
CellLinks = new CellLink[] {
|
CellLinks = new CellLink[] {
|
||||||
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
|
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
|
||||||
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
|
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
|
||||||
@@ -488,8 +488,8 @@ namespace DHSoftware.Views
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void InitData()
|
private void InitData()
|
||||||
{
|
{
|
||||||
stDetectType.Items.Clear();
|
stDetectType.Items.Clear();
|
||||||
@@ -501,13 +501,13 @@ namespace DHSoftware.Views
|
|||||||
PreOutTable.Binding(detectionConfig.OUTPreTreatParams);
|
PreOutTable.Binding(detectionConfig.OUTPreTreatParams);
|
||||||
lableTable.Binding(detectionConfig.DetectionLableList);
|
lableTable.Binding(detectionConfig.DetectionLableList);
|
||||||
SizeTable.Binding(detectionConfig.SizeTreatParamList);
|
SizeTable.Binding(detectionConfig.SizeTreatParamList);
|
||||||
|
|
||||||
|
|
||||||
if (detectionConfig.PreTreatParams.Count > 0)
|
if (detectionConfig.PreTreatParams.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (var item in detectionConfig.PreTreatParams)
|
foreach (var item in detectionConfig.PreTreatParams)
|
||||||
{
|
{
|
||||||
|
|
||||||
item.CellLinks = new CellLink[] {
|
item.CellLinks = new CellLink[] {
|
||||||
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
|
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
|
||||||
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||||
@@ -573,8 +573,8 @@ namespace DHSoftware.Views
|
|||||||
//2
|
//2
|
||||||
sthDetectStatus.DataBindings.Add("Checked", detectionConfig, "IsEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
|
sthDetectStatus.DataBindings.Add("Checked", detectionConfig, "IsEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
|
||||||
sthStation.DataBindings.Add("Checked", detectionConfig, "IsAddStation", true, DataSourceUpdateMode.OnPropertyChanged);
|
sthStation.DataBindings.Add("Checked", detectionConfig, "IsAddStation", true, DataSourceUpdateMode.OnPropertyChanged);
|
||||||
stDetectType.DataBindings.Add("Text", detectionConfig, "ModelType",true, DataSourceUpdateMode.OnPropertyChanged);
|
stDetectType.DataBindings.Add("Text", detectionConfig, "ModelType", true, DataSourceUpdateMode.OnPropertyChanged);
|
||||||
iptConfidence.DataBindings.Add("Text", detectionConfig, "ModelconfThreshold", true, DataSourceUpdateMode.OnPropertyChanged);
|
iptConfidence.DataBindings.Add("Text", detectionConfig, "ModelconfThreshold", true, DataSourceUpdateMode.OnPropertyChanged);
|
||||||
iptDetectPath.DataBindings.Add("Text", detectionConfig, "ModelPath", true, DataSourceUpdateMode.OnPropertyChanged);
|
iptDetectPath.DataBindings.Add("Text", detectionConfig, "ModelPath", true, DataSourceUpdateMode.OnPropertyChanged);
|
||||||
sthOKOriginal.DataBindings.Add("Checked", detectionConfig, "SaveOKOriginal", true, DataSourceUpdateMode.OnPropertyChanged);
|
sthOKOriginal.DataBindings.Add("Checked", detectionConfig, "SaveOKOriginal", true, DataSourceUpdateMode.OnPropertyChanged);
|
||||||
sthNGOriginal.DataBindings.Add("Checked", detectionConfig, "SaveNGOriginal", true, DataSourceUpdateMode.OnPropertyChanged);
|
sthNGOriginal.DataBindings.Add("Checked", detectionConfig, "SaveNGOriginal", true, DataSourceUpdateMode.OnPropertyChanged);
|
||||||
@@ -644,16 +644,6 @@ namespace DHSoftware.Views
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
213
DHSoftware/Views/PreTreatUserControl.Designer.cs
generated
213
DHSoftware/Views/PreTreatUserControl.Designer.cs
generated
@@ -1,213 +0,0 @@
|
|||||||
namespace DHSoftware.Views
|
|
||||||
{
|
|
||||||
partial class PreTreatUserControl
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
btnPreOpen = new AntdUI.Button();
|
|
||||||
tbxPrePath = new TextBox();
|
|
||||||
label1 = new AntdUI.Label();
|
|
||||||
panel1 = new Panel();
|
|
||||||
btnOParmDel = new Panel();
|
|
||||||
label3 = new Label();
|
|
||||||
btnDelOParm = new AntdUI.Button();
|
|
||||||
tbOutputParm = new AntdUI.Table();
|
|
||||||
btnAddOParm = new AntdUI.Button();
|
|
||||||
panel2 = new Panel();
|
|
||||||
label2 = new Label();
|
|
||||||
btnDelIParm = new AntdUI.Button();
|
|
||||||
tbInputParm = new AntdUI.Table();
|
|
||||||
btnAddIParm = new AntdUI.Button();
|
|
||||||
panel1.SuspendLayout();
|
|
||||||
btnOParmDel.SuspendLayout();
|
|
||||||
panel2.SuspendLayout();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// btnPreOpen
|
|
||||||
//
|
|
||||||
btnPreOpen.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
btnPreOpen.Location = new Point(570, 17);
|
|
||||||
btnPreOpen.Name = "btnPreOpen";
|
|
||||||
btnPreOpen.Size = new Size(28, 23);
|
|
||||||
btnPreOpen.TabIndex = 21;
|
|
||||||
btnPreOpen.Text = "...";
|
|
||||||
btnPreOpen.Click += btnPreOpen_Click;
|
|
||||||
//
|
|
||||||
// tbxPrePath
|
|
||||||
//
|
|
||||||
tbxPrePath.Location = new Point(91, 17);
|
|
||||||
tbxPrePath.Name = "tbxPrePath";
|
|
||||||
tbxPrePath.Size = new Size(473, 23);
|
|
||||||
tbxPrePath.TabIndex = 20;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.Location = new Point(12, 17);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(73, 23);
|
|
||||||
label1.TabIndex = 19;
|
|
||||||
label1.Text = "预处理路径";
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
panel1.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
panel1.Controls.Add(btnOParmDel);
|
|
||||||
panel1.Controls.Add(panel2);
|
|
||||||
panel1.Controls.Add(label1);
|
|
||||||
panel1.Controls.Add(btnPreOpen);
|
|
||||||
panel1.Controls.Add(tbxPrePath);
|
|
||||||
panel1.Location = new Point(0, 0);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
panel1.Size = new Size(633, 243);
|
|
||||||
panel1.TabIndex = 22;
|
|
||||||
//
|
|
||||||
// btnOParmDel
|
|
||||||
//
|
|
||||||
btnOParmDel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
btnOParmDel.Controls.Add(label3);
|
|
||||||
btnOParmDel.Controls.Add(btnDelOParm);
|
|
||||||
btnOParmDel.Controls.Add(tbOutputParm);
|
|
||||||
btnOParmDel.Controls.Add(btnAddOParm);
|
|
||||||
btnOParmDel.Location = new Point(352, 44);
|
|
||||||
btnOParmDel.Name = "btnOParmDel";
|
|
||||||
btnOParmDel.Size = new Size(246, 194);
|
|
||||||
btnOParmDel.TabIndex = 26;
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
label3.AutoSize = true;
|
|
||||||
label3.Location = new Point(3, 2);
|
|
||||||
label3.Name = "label3";
|
|
||||||
label3.Size = new Size(56, 17);
|
|
||||||
label3.TabIndex = 25;
|
|
||||||
label3.Text = "输出参数";
|
|
||||||
//
|
|
||||||
// btnDelOParm
|
|
||||||
//
|
|
||||||
btnDelOParm.Location = new Point(93, 25);
|
|
||||||
btnDelOParm.Name = "btnDelOParm";
|
|
||||||
btnDelOParm.Size = new Size(84, 34);
|
|
||||||
btnDelOParm.TabIndex = 24;
|
|
||||||
btnDelOParm.Text = "删除";
|
|
||||||
//
|
|
||||||
// tbOutputParm
|
|
||||||
//
|
|
||||||
tbOutputParm.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
tbOutputParm.Location = new Point(3, 65);
|
|
||||||
tbOutputParm.Name = "tbOutputParm";
|
|
||||||
tbOutputParm.Size = new Size(240, 126);
|
|
||||||
tbOutputParm.TabIndex = 22;
|
|
||||||
tbOutputParm.Text = "table2";
|
|
||||||
//
|
|
||||||
// btnAddOParm
|
|
||||||
//
|
|
||||||
btnAddOParm.Location = new Point(3, 25);
|
|
||||||
btnAddOParm.Name = "btnAddOParm";
|
|
||||||
btnAddOParm.Size = new Size(84, 34);
|
|
||||||
btnAddOParm.TabIndex = 23;
|
|
||||||
btnAddOParm.Text = "新增";
|
|
||||||
//
|
|
||||||
// panel2
|
|
||||||
//
|
|
||||||
panel2.Controls.Add(label2);
|
|
||||||
panel2.Controls.Add(btnDelIParm);
|
|
||||||
panel2.Controls.Add(tbInputParm);
|
|
||||||
panel2.Controls.Add(btnAddIParm);
|
|
||||||
panel2.Location = new Point(12, 45);
|
|
||||||
panel2.Name = "panel2";
|
|
||||||
panel2.Size = new Size(264, 194);
|
|
||||||
panel2.TabIndex = 25;
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(3, 5);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(56, 17);
|
|
||||||
label2.TabIndex = 25;
|
|
||||||
label2.Text = "输入参数";
|
|
||||||
//
|
|
||||||
// btnDelIParm
|
|
||||||
//
|
|
||||||
btnDelIParm.Location = new Point(93, 25);
|
|
||||||
btnDelIParm.Name = "btnDelIParm";
|
|
||||||
btnDelIParm.Size = new Size(84, 34);
|
|
||||||
btnDelIParm.TabIndex = 24;
|
|
||||||
btnDelIParm.Text = "删除";
|
|
||||||
//
|
|
||||||
// tbInputParm
|
|
||||||
//
|
|
||||||
tbInputParm.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
tbInputParm.Location = new Point(3, 65);
|
|
||||||
tbInputParm.Name = "tbInputParm";
|
|
||||||
tbInputParm.Size = new Size(258, 126);
|
|
||||||
tbInputParm.TabIndex = 22;
|
|
||||||
tbInputParm.Text = "table1";
|
|
||||||
//
|
|
||||||
// btnAddIParm
|
|
||||||
//
|
|
||||||
btnAddIParm.Location = new Point(3, 25);
|
|
||||||
btnAddIParm.Name = "btnAddIParm";
|
|
||||||
btnAddIParm.Size = new Size(84, 34);
|
|
||||||
btnAddIParm.TabIndex = 23;
|
|
||||||
btnAddIParm.Text = "新增";
|
|
||||||
//
|
|
||||||
// PreTreatUserControl
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
Controls.Add(panel1);
|
|
||||||
Name = "PreTreatUserControl";
|
|
||||||
Size = new Size(635, 243);
|
|
||||||
panel1.ResumeLayout(false);
|
|
||||||
panel1.PerformLayout();
|
|
||||||
btnOParmDel.ResumeLayout(false);
|
|
||||||
btnOParmDel.PerformLayout();
|
|
||||||
panel2.ResumeLayout(false);
|
|
||||||
panel2.PerformLayout();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private AntdUI.Button btnPreOpen;
|
|
||||||
private TextBox tbxPrePath;
|
|
||||||
private AntdUI.Label label1;
|
|
||||||
private Panel panel1;
|
|
||||||
private AntdUI.Button btnDelIParm;
|
|
||||||
private AntdUI.Button btnAddIParm;
|
|
||||||
private AntdUI.Table tbInputParm;
|
|
||||||
private Panel panel2;
|
|
||||||
private Panel btnOParmDel;
|
|
||||||
private Label label3;
|
|
||||||
private AntdUI.Button btnDelOParm;
|
|
||||||
private AntdUI.Table tbOutputParm;
|
|
||||||
private AntdUI.Button btnAddOParm;
|
|
||||||
private Label label2;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,25 +0,0 @@
|
|||||||
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;
|
|
||||||
|
|
||||||
namespace DHSoftware.Views
|
|
||||||
{
|
|
||||||
public partial class PreTreatUserControl : UserControl
|
|
||||||
{
|
|
||||||
public PreTreatUserControl()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnPreOpen_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
122
DHSoftware/Views/SizeControl.Designer.cs
generated
122
DHSoftware/Views/SizeControl.Designer.cs
generated
@@ -28,24 +28,32 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
AntdUI.Tabs.StyleLine styleLine1 = new AntdUI.Tabs.StyleLine();
|
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SizeControl));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SizeControl));
|
||||||
|
AntdUI.Tabs.StyleLine styleLine1 = new AntdUI.Tabs.StyleLine();
|
||||||
tabPage3 = new AntdUI.TabPage();
|
tabPage3 = new AntdUI.TabPage();
|
||||||
tabPage4 = new AntdUI.TabPage();
|
tabPage4 = new AntdUI.TabPage();
|
||||||
tabs1 = new AntdUI.Tabs();
|
panel3 = new AntdUI.Panel();
|
||||||
|
SizeTable = new AntdUI.Table();
|
||||||
|
panel2 = new AntdUI.Panel();
|
||||||
|
flowCameraPanel = new AntdUI.FlowPanel();
|
||||||
|
btnCorrelatedCamera = new AntdUI.Button();
|
||||||
|
label11 = new AntdUI.Label();
|
||||||
panel1 = new AntdUI.Panel();
|
panel1 = new AntdUI.Panel();
|
||||||
btnSizeDel = new AntdUI.Button();
|
btnSizeDel = new AntdUI.Button();
|
||||||
btnSizeAdd = new AntdUI.Button();
|
btnSizeAdd = new AntdUI.Button();
|
||||||
SizeTable = new AntdUI.Table();
|
tabs1 = new AntdUI.Tabs();
|
||||||
tabPage3.SuspendLayout();
|
tabPage3.SuspendLayout();
|
||||||
tabPage4.SuspendLayout();
|
tabPage4.SuspendLayout();
|
||||||
tabs1.SuspendLayout();
|
panel3.SuspendLayout();
|
||||||
|
panel2.SuspendLayout();
|
||||||
panel1.SuspendLayout();
|
panel1.SuspendLayout();
|
||||||
|
tabs1.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// tabPage3
|
// tabPage3
|
||||||
//
|
//
|
||||||
tabPage3.Controls.Add(tabPage4);
|
tabPage3.Controls.Add(tabPage4);
|
||||||
|
tabPage3.Dock = DockStyle.None;
|
||||||
tabPage3.Location = new Point(3, 31);
|
tabPage3.Location = new Point(3, 31);
|
||||||
tabPage3.Name = "tabPage3";
|
tabPage3.Name = "tabPage3";
|
||||||
tabPage3.Size = new Size(909, 575);
|
tabPage3.Size = new Size(909, 575);
|
||||||
@@ -54,7 +62,8 @@
|
|||||||
//
|
//
|
||||||
// tabPage4
|
// tabPage4
|
||||||
//
|
//
|
||||||
tabPage4.Controls.Add(SizeTable);
|
tabPage4.Controls.Add(panel3);
|
||||||
|
tabPage4.Controls.Add(panel2);
|
||||||
tabPage4.Controls.Add(panel1);
|
tabPage4.Controls.Add(panel1);
|
||||||
tabPage4.Location = new Point(8, 8);
|
tabPage4.Location = new Point(8, 8);
|
||||||
tabPage4.Name = "tabPage4";
|
tabPage4.Name = "tabPage4";
|
||||||
@@ -62,18 +71,71 @@
|
|||||||
tabPage4.TabIndex = 1;
|
tabPage4.TabIndex = 1;
|
||||||
tabPage4.Text = "预处理";
|
tabPage4.Text = "预处理";
|
||||||
//
|
//
|
||||||
// tabs1
|
// panel3
|
||||||
//
|
//
|
||||||
tabs1.Centered = true;
|
panel3.Controls.Add(SizeTable);
|
||||||
tabs1.Dock = DockStyle.Fill;
|
panel3.Dock = DockStyle.Fill;
|
||||||
tabs1.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
panel3.Location = new Point(0, 87);
|
||||||
tabs1.Location = new Point(0, 0);
|
panel3.Name = "panel3";
|
||||||
tabs1.Name = "tabs1";
|
panel3.Size = new Size(909, 488);
|
||||||
tabs1.Pages.Add(tabPage3);
|
panel3.TabIndex = 11;
|
||||||
tabs1.Size = new Size(915, 609);
|
panel3.Text = "panel3";
|
||||||
tabs1.Style = styleLine1;
|
//
|
||||||
tabs1.TabIndex = 1;
|
// SizeTable
|
||||||
tabs1.Text = "tabs1";
|
//
|
||||||
|
SizeTable.Dock = DockStyle.Fill;
|
||||||
|
SizeTable.EmptyHeader = true;
|
||||||
|
SizeTable.Location = new Point(0, 0);
|
||||||
|
SizeTable.Name = "SizeTable";
|
||||||
|
SizeTable.Size = new Size(909, 488);
|
||||||
|
SizeTable.TabIndex = 10;
|
||||||
|
SizeTable.Text = "table1";
|
||||||
|
//
|
||||||
|
// panel2
|
||||||
|
//
|
||||||
|
panel2.Controls.Add(flowCameraPanel);
|
||||||
|
panel2.Controls.Add(btnCorrelatedCamera);
|
||||||
|
panel2.Controls.Add(label11);
|
||||||
|
panel2.Dock = DockStyle.Top;
|
||||||
|
panel2.Location = new Point(0, 42);
|
||||||
|
panel2.Margin = new Padding(3, 3, 10, 3);
|
||||||
|
panel2.Name = "panel2";
|
||||||
|
panel2.Size = new Size(909, 45);
|
||||||
|
panel2.TabIndex = 8;
|
||||||
|
panel2.Text = "panel2";
|
||||||
|
//
|
||||||
|
// flowCameraPanel
|
||||||
|
//
|
||||||
|
flowCameraPanel.AutoScroll = true;
|
||||||
|
flowCameraPanel.BackColor = SystemColors.Window;
|
||||||
|
flowCameraPanel.Dock = DockStyle.Left;
|
||||||
|
flowCameraPanel.Location = new Point(74, 0);
|
||||||
|
flowCameraPanel.Name = "flowCameraPanel";
|
||||||
|
flowCameraPanel.Size = new Size(645, 45);
|
||||||
|
flowCameraPanel.TabIndex = 36;
|
||||||
|
flowCameraPanel.Text = "flowPanel1";
|
||||||
|
//
|
||||||
|
// btnCorrelatedCamera
|
||||||
|
//
|
||||||
|
btnCorrelatedCamera.BorderWidth = 2F;
|
||||||
|
btnCorrelatedCamera.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnCorrelatedCamera.Ghost = true;
|
||||||
|
btnCorrelatedCamera.IconRatio = 0.8F;
|
||||||
|
btnCorrelatedCamera.IconSvg = resources.GetString("btnCorrelatedCamera.IconSvg");
|
||||||
|
btnCorrelatedCamera.Location = new Point(750, 2);
|
||||||
|
btnCorrelatedCamera.Name = "btnCorrelatedCamera";
|
||||||
|
btnCorrelatedCamera.Size = new Size(110, 40);
|
||||||
|
btnCorrelatedCamera.TabIndex = 34;
|
||||||
|
btnCorrelatedCamera.Text = "关联";
|
||||||
|
//
|
||||||
|
// label11
|
||||||
|
//
|
||||||
|
label11.Dock = DockStyle.Left;
|
||||||
|
label11.Location = new Point(0, 0);
|
||||||
|
label11.Name = "label11";
|
||||||
|
label11.Size = new Size(74, 45);
|
||||||
|
label11.TabIndex = 35;
|
||||||
|
label11.Text = "关联相机";
|
||||||
//
|
//
|
||||||
// panel1
|
// panel1
|
||||||
//
|
//
|
||||||
@@ -114,15 +176,18 @@
|
|||||||
btnSizeAdd.TabIndex = 11;
|
btnSizeAdd.TabIndex = 11;
|
||||||
btnSizeAdd.Text = "新增";
|
btnSizeAdd.Text = "新增";
|
||||||
//
|
//
|
||||||
// SizeTable
|
// tabs1
|
||||||
//
|
//
|
||||||
SizeTable.Dock = DockStyle.Fill;
|
tabs1.Centered = true;
|
||||||
SizeTable.EmptyHeader = true;
|
tabs1.Dock = DockStyle.Fill;
|
||||||
SizeTable.Location = new Point(0, 42);
|
tabs1.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
SizeTable.Name = "SizeTable";
|
tabs1.Location = new Point(0, 0);
|
||||||
SizeTable.Size = new Size(909, 533);
|
tabs1.Name = "tabs1";
|
||||||
SizeTable.TabIndex = 10;
|
tabs1.Pages.Add(tabPage3);
|
||||||
SizeTable.Text = "table1";
|
tabs1.Size = new Size(915, 609);
|
||||||
|
tabs1.Style = styleLine1;
|
||||||
|
tabs1.TabIndex = 1;
|
||||||
|
tabs1.Text = "tabs1";
|
||||||
//
|
//
|
||||||
// SizeControl
|
// SizeControl
|
||||||
//
|
//
|
||||||
@@ -133,8 +198,10 @@
|
|||||||
Size = new Size(915, 609);
|
Size = new Size(915, 609);
|
||||||
tabPage3.ResumeLayout(false);
|
tabPage3.ResumeLayout(false);
|
||||||
tabPage4.ResumeLayout(false);
|
tabPage4.ResumeLayout(false);
|
||||||
tabs1.ResumeLayout(false);
|
panel3.ResumeLayout(false);
|
||||||
|
panel2.ResumeLayout(false);
|
||||||
panel1.ResumeLayout(false);
|
panel1.ResumeLayout(false);
|
||||||
|
tabs1.ResumeLayout(false);
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,5 +214,10 @@
|
|||||||
private AntdUI.Panel panel1;
|
private AntdUI.Panel panel1;
|
||||||
private AntdUI.Button btnSizeDel;
|
private AntdUI.Button btnSizeDel;
|
||||||
private AntdUI.Button btnSizeAdd;
|
private AntdUI.Button btnSizeAdd;
|
||||||
|
private AntdUI.FlowPanel flowCameraPanel;
|
||||||
|
private AntdUI.Label label11;
|
||||||
|
private AntdUI.Button btnCorrelatedCamera;
|
||||||
|
private AntdUI.Panel panel2;
|
||||||
|
private AntdUI.Panel panel3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,51 @@ namespace DHSoftware.Views
|
|||||||
btnSizeAdd.Click += BtnSizeAdd_Click;
|
btnSizeAdd.Click += BtnSizeAdd_Click;
|
||||||
btnSizeDel.Click += BtnSizeDelete_Click;
|
btnSizeDel.Click += BtnSizeDelete_Click;
|
||||||
SizeTable.CellButtonClick += SizeTable_CellButtonClick;
|
SizeTable.CellButtonClick += SizeTable_CellButtonClick;
|
||||||
|
btnCorrelatedCamera.Click += BtnCorrelatedCamera_Click;
|
||||||
|
}
|
||||||
|
private void BtnCorrelatedCamera_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
var form = new CorrelatedCameraEdit(window, detectionConfig.CameraCollects) { Size = new Size(500, 400) };
|
||||||
|
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
|
||||||
|
{
|
||||||
|
BtnHeight = 0,
|
||||||
|
});
|
||||||
|
if (form.submit)
|
||||||
|
{
|
||||||
|
flowCameraPanel.Controls.Clear();
|
||||||
|
if (detectionConfig.CameraCollects.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in detectionConfig.CameraCollects)
|
||||||
|
{
|
||||||
|
var control = new AntdUI.Tag()
|
||||||
|
{
|
||||||
|
Font = new System.Drawing.Font("Microsoft YaHei UI", 9F),
|
||||||
|
Size = new Size(90, 42),
|
||||||
|
Text = item.CameraSourceId,
|
||||||
|
CloseIcon = true
|
||||||
|
};
|
||||||
|
control.CloseChanged += (sender, e) =>
|
||||||
|
{
|
||||||
|
var tag = sender as Tag;
|
||||||
|
foreach (var item in detectionConfig.CameraCollects)
|
||||||
|
{
|
||||||
|
if (item.CameraSourceId.Equals(tag.Text))
|
||||||
|
{
|
||||||
|
detectionConfig.CameraCollects.Remove(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
|
};
|
||||||
|
// 通过主窗口设置DPI控制添加控件保持缩放比例
|
||||||
|
window.AutoDpi(control);
|
||||||
|
flowCameraPanel.Controls.Add(control);
|
||||||
|
control.BringToFront();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -75,7 +119,7 @@ namespace DHSoftware.Views
|
|||||||
case "3":
|
case "3":
|
||||||
case "4":
|
case "4":
|
||||||
case "5":
|
case "5":
|
||||||
FrmMain3 frmMain3 = new FrmMain3(sizeType);
|
FrmMainSize frmMain3 = new FrmMainSize(sizeType, detectionConfig);
|
||||||
frmMain3.ShowDialog();
|
frmMain3.ShowDialog();
|
||||||
if (!string.IsNullOrEmpty(frmMain3.inputtext))
|
if (!string.IsNullOrEmpty(frmMain3.inputtext))
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
@@ -117,6 +117,9 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<data name="btnCorrelatedCamera.IconSvg" xml:space="preserve">
|
||||||
|
<value><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"><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"/></svg></value>
|
||||||
|
</data>
|
||||||
<data name="btnSizeDel.IconSvg" xml:space="preserve">
|
<data name="btnSizeDel.IconSvg" xml:space="preserve">
|
||||||
<value><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"><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"/></svg></value>
|
<value><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"><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"/></svg></value>
|
||||||
</data>
|
</data>
|
||||||
|
167
DHSoftware/Views/UserConfigFrm.Designer.cs
generated
167
DHSoftware/Views/UserConfigFrm.Designer.cs
generated
@@ -1,167 +0,0 @@
|
|||||||
namespace DHSoftware.Views
|
|
||||||
{
|
|
||||||
partial class UserConfigFrm
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
AntdUI.Tabs.StyleCard styleCard1 = new AntdUI.Tabs.StyleCard();
|
|
||||||
pnlMenu = new AntdUI.Panel();
|
|
||||||
panel3 = new AntdUI.Panel();
|
|
||||||
btnSave = new AntdUI.Button();
|
|
||||||
btnAdd = new AntdUI.Button();
|
|
||||||
menu = new AntdUI.Menu();
|
|
||||||
panel2 = new AntdUI.Panel();
|
|
||||||
divider1 = new AntdUI.Divider();
|
|
||||||
tabs = new AntdUI.Tabs();
|
|
||||||
pnlMenu.SuspendLayout();
|
|
||||||
panel3.SuspendLayout();
|
|
||||||
panel2.SuspendLayout();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// pnlMenu
|
|
||||||
//
|
|
||||||
pnlMenu.Controls.Add(panel3);
|
|
||||||
pnlMenu.Controls.Add(menu);
|
|
||||||
pnlMenu.Dock = DockStyle.Left;
|
|
||||||
pnlMenu.Location = new Point(0, 0);
|
|
||||||
pnlMenu.Name = "pnlMenu";
|
|
||||||
pnlMenu.Size = new Size(135, 542);
|
|
||||||
pnlMenu.TabIndex = 0;
|
|
||||||
pnlMenu.Text = "panel1";
|
|
||||||
//
|
|
||||||
// panel3
|
|
||||||
//
|
|
||||||
panel3.Back = SystemColors.Window;
|
|
||||||
panel3.BackColor = SystemColors.Window;
|
|
||||||
panel3.Controls.Add(btnSave);
|
|
||||||
panel3.Controls.Add(btnAdd);
|
|
||||||
panel3.Dock = DockStyle.Bottom;
|
|
||||||
panel3.Location = new Point(0, 516);
|
|
||||||
panel3.Name = "panel3";
|
|
||||||
panel3.Size = new Size(135, 26);
|
|
||||||
panel3.TabIndex = 2;
|
|
||||||
panel3.Text = "panel3";
|
|
||||||
//
|
|
||||||
// btnSave
|
|
||||||
//
|
|
||||||
btnSave.BackActive = SystemColors.Control;
|
|
||||||
btnSave.BackColor = SystemColors.Control;
|
|
||||||
btnSave.Dock = DockStyle.Left;
|
|
||||||
btnSave.ForeColor = Color.Black;
|
|
||||||
btnSave.IconRatio = 1F;
|
|
||||||
btnSave.IconSvg = "AppstoreAddOutlined";
|
|
||||||
btnSave.Location = new Point(35, 0);
|
|
||||||
btnSave.Name = "btnSave";
|
|
||||||
btnSave.Size = new Size(35, 26);
|
|
||||||
btnSave.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// btnAdd
|
|
||||||
//
|
|
||||||
btnAdd.BackActive = SystemColors.Control;
|
|
||||||
btnAdd.BackColor = SystemColors.Control;
|
|
||||||
btnAdd.Dock = DockStyle.Left;
|
|
||||||
btnAdd.ForeColor = Color.Black;
|
|
||||||
btnAdd.IconRatio = 1F;
|
|
||||||
btnAdd.IconSvg = "AppstoreAddOutlined";
|
|
||||||
btnAdd.Location = new Point(0, 0);
|
|
||||||
btnAdd.Name = "btnAdd";
|
|
||||||
btnAdd.Size = new Size(35, 26);
|
|
||||||
btnAdd.TabIndex = 1;
|
|
||||||
btnAdd.Click += btnAdd_Click;
|
|
||||||
//
|
|
||||||
// menu
|
|
||||||
//
|
|
||||||
menu.Dock = DockStyle.Fill;
|
|
||||||
menu.Location = new Point(0, 0);
|
|
||||||
menu.Name = "menu";
|
|
||||||
menu.Size = new Size(135, 542);
|
|
||||||
menu.TabIndex = 0;
|
|
||||||
menu.Text = "menu1";
|
|
||||||
menu.SelectChanged += Menu_SelectChanged;
|
|
||||||
menu.MouseDown += Menu_MouseDown;
|
|
||||||
//
|
|
||||||
// panel2
|
|
||||||
//
|
|
||||||
panel2.Controls.Add(divider1);
|
|
||||||
panel2.Controls.Add(tabs);
|
|
||||||
panel2.Dock = DockStyle.Fill;
|
|
||||||
panel2.Location = new Point(135, 0);
|
|
||||||
panel2.Name = "panel2";
|
|
||||||
panel2.Size = new Size(745, 542);
|
|
||||||
panel2.TabIndex = 1;
|
|
||||||
panel2.Text = "panel2";
|
|
||||||
//
|
|
||||||
// divider1
|
|
||||||
//
|
|
||||||
divider1.BackColor = SystemColors.ActiveCaption;
|
|
||||||
divider1.Dock = DockStyle.Left;
|
|
||||||
divider1.Location = new Point(0, 0);
|
|
||||||
divider1.Name = "divider1";
|
|
||||||
divider1.Size = new Size(10, 542);
|
|
||||||
divider1.TabIndex = 1;
|
|
||||||
divider1.Text = "";
|
|
||||||
divider1.Vertical = true;
|
|
||||||
//
|
|
||||||
// tabs
|
|
||||||
//
|
|
||||||
tabs.Dock = DockStyle.Fill;
|
|
||||||
tabs.Location = new Point(0, 0);
|
|
||||||
tabs.Name = "tabs";
|
|
||||||
tabs.Size = new Size(745, 542);
|
|
||||||
tabs.Style = styleCard1;
|
|
||||||
tabs.TabIndex = 0;
|
|
||||||
tabs.Text = "tabs1";
|
|
||||||
tabs.Type = AntdUI.TabType.Card;
|
|
||||||
tabs.SelectedIndexChanged += tabs_SelectedIndexChanged;
|
|
||||||
//
|
|
||||||
// UserConfigFrm
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
AutoSize = true;
|
|
||||||
Controls.Add(panel2);
|
|
||||||
Controls.Add(pnlMenu);
|
|
||||||
Name = "UserConfigFrm";
|
|
||||||
Size = new Size(880, 542);
|
|
||||||
pnlMenu.ResumeLayout(false);
|
|
||||||
panel3.ResumeLayout(false);
|
|
||||||
panel2.ResumeLayout(false);
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
private AntdUI.Tabs tabs;
|
|
||||||
private AntdUI.Panel pnlMenu;
|
|
||||||
private AntdUI.Panel panel2;
|
|
||||||
private AntdUI.Menu menu;
|
|
||||||
private AntdUI.Panel panel3;
|
|
||||||
private AntdUI.Button btnSave;
|
|
||||||
private AntdUI.Button btnAdd;
|
|
||||||
private AntdUI.Divider divider1;
|
|
||||||
// private AntdUI.Tabs tabs;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,257 +0,0 @@
|
|||||||
using AntdUI;
|
|
||||||
using AntdUIDemo.Models;
|
|
||||||
using DH.Commons.Base;
|
|
||||||
using DH.Devices.Vision;
|
|
||||||
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 System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
||||||
using Window = AntdUI.Window;
|
|
||||||
|
|
||||||
namespace DHSoftware.Views
|
|
||||||
{
|
|
||||||
public partial class UserConfigFrm : UserControl
|
|
||||||
{
|
|
||||||
public List<CameraBase> cameras = new List<CameraBase>();
|
|
||||||
public List<DetectionConfig> detections = new List<DetectionConfig>();
|
|
||||||
private UserControl currControl;
|
|
||||||
private bool isUpdatingTabs = false;//用于阻止Tabs更新
|
|
||||||
public Window Window;
|
|
||||||
public UserConfigFrm()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
LoadMenu();
|
|
||||||
menu.Width = (int)(100 * Config.Dpi);
|
|
||||||
|
|
||||||
}
|
|
||||||
private void LoadMenu(string filter = "")
|
|
||||||
{
|
|
||||||
menu.Items.Clear();
|
|
||||||
|
|
||||||
string lang = AntdUI.Localization.CurrentLanguage;
|
|
||||||
var menuItems = DataUtil.Menu_decetion;
|
|
||||||
//var menuIcons = DataUtil.MenuIcons_zhcn;
|
|
||||||
//if (lang.StartsWith("en"))
|
|
||||||
//{
|
|
||||||
// menuItems = DataUtil.MenuItems_enus;
|
|
||||||
// menuIcons = DataUtil.MenuIcons_enus;
|
|
||||||
//}
|
|
||||||
|
|
||||||
foreach (var rootItem in menuItems)
|
|
||||||
{
|
|
||||||
var rootKey = rootItem.Key.ToLower();
|
|
||||||
var rootMenu = new AntdUI.MenuItem
|
|
||||||
{
|
|
||||||
Text = rootItem.Key,
|
|
||||||
//IconSvg = menuIcons.TryGetValue(rootItem.Key, out var icon) ? icon : "UnorderedListOutlined",
|
|
||||||
};
|
|
||||||
bool rootVisible = false; // 用于标记是否显示根节点
|
|
||||||
|
|
||||||
foreach (var item in rootItem.Value)
|
|
||||||
{
|
|
||||||
var childText = item.Text.ToLower();
|
|
||||||
|
|
||||||
// 如果子节点包含搜索文本
|
|
||||||
if (childText.Contains(filter))
|
|
||||||
{
|
|
||||||
var menuItem = new AntdUI.MenuItem
|
|
||||||
{
|
|
||||||
Text = item.Text,
|
|
||||||
IconSvg = item.IconSvg,
|
|
||||||
Tag = item.Tag,
|
|
||||||
};
|
|
||||||
rootMenu.Sub.Add(menuItem);
|
|
||||||
rootVisible = true; // 如果有子节点包含,则显示根节点
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果根节点包含搜索文本,或有可见的子节点,则显示根节点
|
|
||||||
if (rootKey.Contains(filter) || rootVisible)
|
|
||||||
{
|
|
||||||
menu.Items.Add(rootMenu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void SelectMenu()
|
|
||||||
{
|
|
||||||
if (isUpdatingTabs) return;
|
|
||||||
var text = tabs.SelectedTab?.Text; // 使用安全导航操作符,防止 SelectedTab 为 null
|
|
||||||
if (string.IsNullOrEmpty(text)) // 检查 text 是否为 null 或空
|
|
||||||
{
|
|
||||||
return; // 如果 text 为空,直接退出方法
|
|
||||||
}
|
|
||||||
//首页
|
|
||||||
if (text == AntdUI.Localization.Get("home", "主页"))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var rootIndex = 0;
|
|
||||||
var subIndex = 0;
|
|
||||||
var menuItemsCopy = menu.Items.ToList(); // 创建副本
|
|
||||||
for (int i = 0; i < menuItemsCopy.Count; i++)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < menuItemsCopy[i].Sub.Count; j++)
|
|
||||||
{
|
|
||||||
if (menuItemsCopy[i].Sub[j].Tag.ToString() == text)
|
|
||||||
{
|
|
||||||
rootIndex = i;
|
|
||||||
subIndex = j;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
menu.SelectIndex(rootIndex, subIndex, true);
|
|
||||||
}
|
|
||||||
private void Menu_MouseDown(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Button == MouseButtons.Right)
|
|
||||||
{
|
|
||||||
// 转换坐标到控件内部坐标系(考虑滚动条)
|
|
||||||
Point clickPoint = new Point(e.X, e.Y + menu.ScrollBar.Value);
|
|
||||||
|
|
||||||
// 递归查找命中的菜单项
|
|
||||||
MenuItem clickedItem = FindClickedItem(menu.Items, clickPoint);
|
|
||||||
|
|
||||||
if (clickedItem != null)
|
|
||||||
{
|
|
||||||
// 显示节点名称弹窗
|
|
||||||
//MessageBox.Show($"右键点击的节点: {clickedItem.Text}");
|
|
||||||
|
|
||||||
var menulist = new AntdUI.IContextMenuStripItem[]
|
|
||||||
{
|
|
||||||
new AntdUI.ContextMenuStripItem("关联相机", "")
|
|
||||||
{
|
|
||||||
IconSvg = "VideoCameraAddOutlined"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
AntdUI.ContextMenuStrip.open(menu, it =>
|
|
||||||
{
|
|
||||||
if (it.Text == "关联相机")
|
|
||||||
{
|
|
||||||
//using (var dlg = new AddCameraWindow(cameras))
|
|
||||||
//{
|
|
||||||
// if (dlg.ShowDialog() == DialogResult.OK)
|
|
||||||
// {
|
|
||||||
// var newItem = new MenuItem(dlg.CubicleName);
|
|
||||||
// newItem.IconSvg = "VideoCameraOutlined";
|
|
||||||
// //// 防止重复添加
|
|
||||||
// //if (!menu1.Items.Cast<MenuItem>().Any(m => m.Text == newItem.Text))
|
|
||||||
// //{
|
|
||||||
// clickedItem.Sub.Add(newItem);
|
|
||||||
// //}
|
|
||||||
// //else
|
|
||||||
// //{
|
|
||||||
// // AntdUI.Notification.warn(this, "新增失败", $"{dlg.CubicleName}已存在!", autoClose: 3, align: TAlignFrom.TR);
|
|
||||||
// //}
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}, menulist);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private MenuItem FindClickedItem(MenuItemCollection items, Point clickPoint)
|
|
||||||
{
|
|
||||||
foreach (MenuItem item in items)
|
|
||||||
{
|
|
||||||
// 检查当前项是否可见且包含点击坐标
|
|
||||||
if (item.Visible && item.Rect.Contains(clickPoint))
|
|
||||||
{
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Menu_SelectChanged(object sender, MenuSelectEventArgs e)
|
|
||||||
{
|
|
||||||
string name = (string)e.Value.Tag;
|
|
||||||
|
|
||||||
//// 清理上一个浮动按钮窗体
|
|
||||||
//if (currControl is FloatButtonDemo floatButtonDemo)
|
|
||||||
//{
|
|
||||||
// floatButtonDemo.CloseFloatButtonForm();
|
|
||||||
//}
|
|
||||||
|
|
||||||
// 检查是否已存在同名 TabPage
|
|
||||||
foreach (var tab in tabs.Pages)
|
|
||||||
{
|
|
||||||
if (tab is AntdUI.TabPage existingTab && existingTab.Text == name)
|
|
||||||
{
|
|
||||||
isUpdatingTabs = true;
|
|
||||||
tabs.SelectedTab = existingTab;
|
|
||||||
isUpdatingTabs = false;
|
|
||||||
currControl = existingTab.Controls.Count > 0 ? existingTab.Controls[0] as UserControl : null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int width = tabs.Width;
|
|
||||||
int height = tabs.Height;
|
|
||||||
// 创建新 TabPage
|
|
||||||
UserDetetion control = new UserDetetion(Window,width, height);
|
|
||||||
// control._windows = Window;
|
|
||||||
switch (name)
|
|
||||||
{
|
|
||||||
case "工位1":
|
|
||||||
// control =
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (control != null)
|
|
||||||
{
|
|
||||||
control.Dock = DockStyle.Fill;
|
|
||||||
// AutoDpi(control); // 如果有 DPI 适配逻辑
|
|
||||||
|
|
||||||
var tabPage = new AntdUI.TabPage
|
|
||||||
{
|
|
||||||
Dock = DockStyle.Fill,
|
|
||||||
Text = name,
|
|
||||||
};
|
|
||||||
tabPage.Controls.Add(control);
|
|
||||||
tabs.Pages.Add(tabPage);
|
|
||||||
|
|
||||||
isUpdatingTabs = true;
|
|
||||||
tabs.SelectedTab = tabPage;
|
|
||||||
isUpdatingTabs = false;
|
|
||||||
currControl = control;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void tabs_SelectedIndexChanged(object sender, IntEventArgs e)
|
|
||||||
{
|
|
||||||
SelectMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
//using (var dlg = new AddCubicleWindow())
|
|
||||||
//{
|
|
||||||
// if (dlg.ShowDialog() == DialogResult.OK)
|
|
||||||
// {
|
|
||||||
// var newItem = new MenuItem(dlg.CubicleName);
|
|
||||||
// //newItem.IconSvg = "AppstoreOutlined";
|
|
||||||
// // 防止重复添加
|
|
||||||
// if (!menu.Items.Cast<MenuItem>().Any(m => m.Text == newItem.Text))
|
|
||||||
// {
|
|
||||||
// menu.Items.Add(newItem);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// // AntdUI.Notification.warn(this, "新增工位失败", $"{dlg.CubicleName}已存在!", autoClose: 3, align: TAlignFrom.TR);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
70
DHSoftware/Views/UserDetetion.Designer.cs
generated
70
DHSoftware/Views/UserDetetion.Designer.cs
generated
@@ -1,70 +0,0 @@
|
|||||||
namespace DHSoftware.Views
|
|
||||||
{
|
|
||||||
partial class UserDetetion
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
collapse1 = new AntdUI.Collapse();
|
|
||||||
panel1 = new Panel();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// collapse1
|
|
||||||
//
|
|
||||||
collapse1.Dock = DockStyle.Fill;
|
|
||||||
collapse1.Location = new Point(0, 0);
|
|
||||||
collapse1.Name = "collapse1";
|
|
||||||
collapse1.Size = new Size(842, 568);
|
|
||||||
collapse1.TabIndex = 0;
|
|
||||||
collapse1.Text = "collapse1";
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.BackColor = SystemColors.GradientActiveCaption;
|
|
||||||
panel1.Dock = DockStyle.Left;
|
|
||||||
panel1.Location = new Point(0, 0);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
panel1.Size = new Size(2, 568);
|
|
||||||
panel1.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// UserDetetion
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
Controls.Add(panel1);
|
|
||||||
Controls.Add(collapse1);
|
|
||||||
Name = "UserDetetion";
|
|
||||||
Size = new Size(842, 568);
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private AntdUI.Collapse collapse1;
|
|
||||||
private Panel panel1;
|
|
||||||
//private AntdUI.Button button1;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,226 +0,0 @@
|
|||||||
using AntdUI;
|
|
||||||
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 Button = AntdUI.Button;
|
|
||||||
|
|
||||||
namespace DHSoftware.Views
|
|
||||||
{
|
|
||||||
public partial class UserDetetion : UserControl
|
|
||||||
{
|
|
||||||
private StackPanel panel, panel2, panel3, panel4;
|
|
||||||
public Window _windows;
|
|
||||||
//根据检测配置 将对应的相机配置、中处理预处理、尺寸测量
|
|
||||||
public UserDetetion(Window windows,int parentWidth, int parentHeight)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_windows = windows;
|
|
||||||
AntdUI.CollapseItem group1 = new CollapseItem();
|
|
||||||
group1.Height = parentHeight / 4;
|
|
||||||
group1.Text = "相机配置";
|
|
||||||
AntdUI.CollapseItem group2 = new CollapseItem();
|
|
||||||
group2.Text = "预处理";
|
|
||||||
group2.Height = parentHeight/4;
|
|
||||||
|
|
||||||
AntdUI.CollapseItem group3 = new CollapseItem();
|
|
||||||
group3.Text = "中处理";
|
|
||||||
group3.Height = parentHeight - 300;
|
|
||||||
|
|
||||||
AntdUI.CollapseItem group4 = new CollapseItem();
|
|
||||||
group4.Text = "尺寸测量";
|
|
||||||
group4.Height = parentHeight / 4;
|
|
||||||
|
|
||||||
|
|
||||||
// 初始化内容面板
|
|
||||||
panel = CreateScrollPanel();
|
|
||||||
panel2 = CreateScrollPanel();
|
|
||||||
panel3 = CreateScrollPanel();
|
|
||||||
panel4 = CreateScrollPanel();
|
|
||||||
|
|
||||||
// 添加预处理控件
|
|
||||||
var ptuc = new PreTreatUserControl { AutoScroll = true, Dock = DockStyle.Top };
|
|
||||||
var detect = new DetectConfigControl { AutoScroll = true , Dock = DockStyle.Fill };
|
|
||||||
detect._window = this._windows;
|
|
||||||
|
|
||||||
// 添加尺寸测量控件
|
|
||||||
//var sizeFrm = new SizeControl();
|
|
||||||
|
|
||||||
|
|
||||||
CameraConfigControl camConfigFrm = new CameraConfigControl();
|
|
||||||
camConfigFrm.Dock = DockStyle.Fill;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//PreTreatUserControl ptuc = new PreTreatUserControl();
|
|
||||||
//ptuc.AutoScroll = true;
|
|
||||||
//panel2.Controls.Add(ptuc);
|
|
||||||
//DetectConfigControl detect = new DetectConfigControl();
|
|
||||||
//// detect.Dock = DockStyle.Fill;
|
|
||||||
//detect.AutoScroll = true;
|
|
||||||
//panel2.Controls.Add(detect);
|
|
||||||
|
|
||||||
|
|
||||||
//SizeConfigControl Sizefc = new SizeConfigControl();
|
|
||||||
//Sizefc.Dock = DockStyle.Fill;
|
|
||||||
//panel3.Controls.Add(Sizefc);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Button btnAddCam = new Button
|
|
||||||
{
|
|
||||||
Width = 100,
|
|
||||||
Height = 30,
|
|
||||||
Text = "添加相机配置",
|
|
||||||
//Dock=DockStyle.Bottom
|
|
||||||
};
|
|
||||||
Button btnDelCam = new Button
|
|
||||||
{
|
|
||||||
Width = 100,
|
|
||||||
Height = 30,
|
|
||||||
Text = "删除相机配置",
|
|
||||||
// Dock = DockStyle.Bottom
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Button btnAddModel = new Button
|
|
||||||
{
|
|
||||||
Width = 100,
|
|
||||||
Height = 30,
|
|
||||||
Text = "添加模型配置",
|
|
||||||
//Dock=DockStyle.Bottom
|
|
||||||
};
|
|
||||||
Button btnDelModel = new Button
|
|
||||||
{
|
|
||||||
Width = 100,
|
|
||||||
Height = 30,
|
|
||||||
Text = "删除模型配置",
|
|
||||||
// Dock = DockStyle.Bottom
|
|
||||||
};
|
|
||||||
|
|
||||||
FlowLayoutPanel flow = new FlowLayoutPanel();
|
|
||||||
flow.Dock = DockStyle.Bottom;
|
|
||||||
flow.Controls.Add(btnAddCam);
|
|
||||||
flow.Controls.Add(btnDelCam);
|
|
||||||
|
|
||||||
FlowLayoutPanel flowmodel = new FlowLayoutPanel();
|
|
||||||
flowmodel.Dock = DockStyle.Bottom;
|
|
||||||
flowmodel.Controls.Add(btnAddModel);
|
|
||||||
flowmodel.Controls.Add(btnDelModel);
|
|
||||||
btnAddCam.Click += btnAddCam_Click;
|
|
||||||
btnDelCam.Click += btnDelCam_Click;
|
|
||||||
btnAddModel.Click += btnAddModel_Click;
|
|
||||||
btnDelModel.Click += btnDelModel_Click;
|
|
||||||
|
|
||||||
panel.Controls.Add(flow);
|
|
||||||
panel.Controls.Add(camConfigFrm);
|
|
||||||
|
|
||||||
panel2.Controls.Add(ptuc);
|
|
||||||
panel3.Controls.Add(flowmodel);
|
|
||||||
panel3.Controls.Add(detect);
|
|
||||||
//panel4.Controls.Add(sizeFrm);
|
|
||||||
group1.Controls.Add(panel);
|
|
||||||
group2.Controls.Add(panel2);
|
|
||||||
group3.Controls.Add(panel3);
|
|
||||||
group4.Controls.Add(panel4);
|
|
||||||
|
|
||||||
|
|
||||||
//collapse1.Items.Add(group1);
|
|
||||||
collapse1.Items.Add(group1);
|
|
||||||
collapse1.Items.Add(group2);
|
|
||||||
collapse1.Items.Add(group3);
|
|
||||||
collapse1.Items.Add(group4);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 统一事件处理
|
|
||||||
private void CameraOperation_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (sender is Button btn)
|
|
||||||
{
|
|
||||||
switch (btn.Tag?.ToString())
|
|
||||||
{
|
|
||||||
case "Add":
|
|
||||||
AddCameraConfig();
|
|
||||||
break;
|
|
||||||
case "Delete":
|
|
||||||
DeleteCameraConfig();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 实际业务方法
|
|
||||||
private void AddCameraConfig()
|
|
||||||
{
|
|
||||||
var newCamConfig = new CameraConfigControl { Dock = DockStyle.Top };
|
|
||||||
panel.Controls.Add(newCamConfig);
|
|
||||||
panel.ScrollControlIntoView(newCamConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DeleteCameraConfig()
|
|
||||||
{
|
|
||||||
if (panel.Controls.Count > 1)
|
|
||||||
{
|
|
||||||
panel.Controls.RemoveAt(panel.Controls.Count - 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 创建带滚动条的面板
|
|
||||||
private StackPanel CreateScrollPanel()
|
|
||||||
{
|
|
||||||
return new StackPanel
|
|
||||||
{
|
|
||||||
Dock = DockStyle.Fill,
|
|
||||||
Vertical = true,
|
|
||||||
AutoScroll = true,
|
|
||||||
Padding = new Padding(5) // 添加内边距避免内容贴边
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnAddCam_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
CameraConfigControl camConfigFrm2 = new CameraConfigControl();
|
|
||||||
camConfigFrm2.Dock = DockStyle.Fill;
|
|
||||||
|
|
||||||
panel.Controls.Add(camConfigFrm2);
|
|
||||||
}
|
|
||||||
private void btnDelCam_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
// 遍历 panel 的 Controls,找到最后一个 CameraConfigControl 并移除
|
|
||||||
for (int i = panel.Controls.Count - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
if (panel.Controls[i] is CameraConfigControl)
|
|
||||||
{
|
|
||||||
panel.Controls.RemoveAt(i);
|
|
||||||
break; // 只删除一个
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void btnAddModel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
DetectConfigControl DetectFrm = new DetectConfigControl();
|
|
||||||
DetectFrm._window = this._windows;
|
|
||||||
DetectFrm.Dock = DockStyle.Fill;
|
|
||||||
|
|
||||||
panel3.Controls.Add(DetectFrm);
|
|
||||||
}
|
|
||||||
private void btnDelModel_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
// 遍历 panel 的 Controls,找到最后一个 CameraConfigControl 并移除
|
|
||||||
for (int i = panel3.Controls.Count - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
if (panel3.Controls[i] is DetectConfigControl)
|
|
||||||
{
|
|
||||||
panel3.Controls.RemoveAt(i);
|
|
||||||
break; // 只删除一个
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user