C3204
2025-12-26 df5faaa04b582bec2ae7636478f72996a608f8c3
”添加运动控制功能。“
已修改2个文件
已添加3个文件
1484 ■■■■■ 文件已修改
LB_SmartVision/Forms/Pages/MotionControlPage/MotionControlEditPage.Designer.cs 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/Forms/Pages/MotionControlPage/MotionControlEditPage.cs 155 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/Forms/Pages/MotionControlPage/MotionControlForm.Designer.cs 781 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/Forms/Pages/MotionControlPage/MotionControlForm.cs 369 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/Forms/Pages/MotionControlPage/MotionControlForm.resx 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LB_SmartVision/Forms/Pages/MotionControlPage/MotionControlEditPage.Designer.cs
@@ -33,7 +33,7 @@
        {
            uiButton1 = new HopeButton();
            uiButton2 = new LostButton();
            uiFlowLayoutPanel1 = new FlowLayoutPanel();
            uiMCLayoutPanel1 = new FlowLayoutPanel();
            tableLayoutPanel1 = new TableLayoutPanel();
            tableLayoutPanel2 = new TableLayoutPanel();
            tableLayoutPanel1.SuspendLayout();
@@ -61,6 +61,7 @@
            uiButton1.Text = "增加";
            uiButton1.TextColor = Color.White;
            uiButton1.WarningColor = Color.FromArgb(230, 162, 60);
            uiButton1.Click += uiButton1_Click;
            // 
            // uiButton2
            // 
@@ -78,27 +79,27 @@
            uiButton2.TabIndex = 12;
            uiButton2.Text = "清除";
            // 
            // uiFlowLayoutPanel1
            // uiMCLayoutPanel1
            // 
            uiFlowLayoutPanel1.BackColor = Color.FromArgb(32, 41, 50);
            uiFlowLayoutPanel1.Dock = DockStyle.Fill;
            uiFlowLayoutPanel1.Font = new Font("宋体", 12F);
            uiFlowLayoutPanel1.ForeColor = SystemColors.Control;
            uiFlowLayoutPanel1.Location = new Point(4, 5);
            uiFlowLayoutPanel1.Margin = new Padding(4, 5, 4, 5);
            uiFlowLayoutPanel1.MinimumSize = new Size(1, 1);
            uiFlowLayoutPanel1.Name = "uiFlowLayoutPanel1";
            uiFlowLayoutPanel1.Padding = new Padding(2);
            uiFlowLayoutPanel1.Size = new Size(599, 293);
            uiFlowLayoutPanel1.TabIndex = 10;
            uiFlowLayoutPanel1.Text = "`";
            uiMCLayoutPanel1.BackColor = Color.FromArgb(32, 41, 50);
            uiMCLayoutPanel1.Dock = DockStyle.Fill;
            uiMCLayoutPanel1.Font = new Font("宋体", 12F);
            uiMCLayoutPanel1.ForeColor = SystemColors.Control;
            uiMCLayoutPanel1.Location = new Point(4, 5);
            uiMCLayoutPanel1.Margin = new Padding(4, 5, 4, 5);
            uiMCLayoutPanel1.MinimumSize = new Size(1, 1);
            uiMCLayoutPanel1.Name = "uiMCLayoutPanel1";
            uiMCLayoutPanel1.Padding = new Padding(2);
            uiMCLayoutPanel1.Size = new Size(599, 293);
            uiMCLayoutPanel1.TabIndex = 10;
            uiMCLayoutPanel1.Text = "`";
            // 
            // tableLayoutPanel1
            // 
            tableLayoutPanel1.ColumnCount = 1;
            tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
            tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
            tableLayoutPanel1.Controls.Add(uiFlowLayoutPanel1, 0, 0);
            tableLayoutPanel1.Controls.Add(uiMCLayoutPanel1, 0, 0);
            tableLayoutPanel1.Controls.Add(tableLayoutPanel2, 0, 1);
            tableLayoutPanel1.Dock = DockStyle.Fill;
            tableLayoutPanel1.Location = new Point(0, 0);
@@ -130,8 +131,6 @@
            // 
            // MotionControlEditPage
            // 
            AutoScaleDimensions = new SizeF(96F, 96F);
            AutoScaleMode = AutoScaleMode.Dpi;
            BackColor = Color.FromArgb(32, 41, 50);
            Controls.Add(tableLayoutPanel1);
            ForeColor = SystemColors.Control;
@@ -147,7 +146,7 @@
        private ReaLTaiizor.Controls.HopeButton uiButton1;
        private ReaLTaiizor.Controls.LostButton uiButton2;
        private FlowLayoutPanel uiFlowLayoutPanel1;
        private FlowLayoutPanel uiMCLayoutPanel1;
        private TableLayoutPanel tableLayoutPanel1;
        private TableLayoutPanel tableLayoutPanel2;
    }
LB_SmartVision/Forms/Pages/MotionControlPage/MotionControlEditPage.cs
@@ -1,4 +1,7 @@
using LB_VisionControl;
using LB_SmartVision.Forms.Pages.CameraPage;
using LB_SmartVision.Forms.Pages.MotionControlPage;
using LB_VisionControl;
using LB_VisionProcesses.Cameras;
using OpenCvSharp.Flann;
using System;
using System.Collections.Concurrent;
@@ -11,7 +14,6 @@
    {
        public Action<string, LogInfoType> LogInfo;
        public MotionControlEditPage()
        {
            InitializeComponent();
@@ -22,9 +24,156 @@
        private void MESEditPage_Paint(object sender, PaintEventArgs e)
        {
            uiFlowLayoutPanel1.Controls.Clear();
            uiMCLayoutPanel1.Controls.Clear();
            if (GlobalVar.dicCameras.Count <= 0)
                return;
            foreach (var item in GlobalVar.dicCameras)
            {
                string CameraSN = item.Key;
                string CameraBrand = item.Value.Brand.ToString();
                if (string.IsNullOrEmpty(CameraSN) || string.IsNullOrEmpty(CameraBrand))
                    return;
                UserItem flow = new UserItem(new string[] { "运动控制", "刷新", "移除" });
                flow.Name = CameraSN;
                flow.Text = $"[{CameraBrand}]";
                if (item.Value.isGrabbing)
                    flow.state = State.Pass;
                else
                    flow.state |= State.Error;
                LoadFlowEvent(flow);
                uiMCLayoutPanel1.Controls.Add(flow);
            }
        }
        private void uiButton1_Click(object sender, System.EventArgs e)
        {
            CreateCameraForm createCameraForm = new CreateCameraForm();
            createCameraForm.ShowDialog();
            if (createCameraForm.bCreate)
            {
                BaseCamera camera = createCameraForm.camera;
                if (GlobalVar.dicCameras.ContainsKey(camera.SN))
                {
                    MessageBox.Show($"相机[{camera.SN}]已存在!", "异常");
                    return;
                }
                string CameraSN = camera.SN;//"127.0.0.1"
                string CameraBrand = camera.Brand.ToString();//"1111"
                if (string.IsNullOrEmpty(CameraSN) || string.IsNullOrEmpty(CameraBrand))
                    return;
                GlobalVar.dicCameras.TryAdd(CameraSN, camera);
                LogInfo?.Invoke(string.Format("添加相机[{0}][{1}]成功", CameraBrand, CameraSN), LogInfoType.PASS);
            }
            this.Invalidate();
        }
        private void uiButton2_Click(object sender, System.EventArgs e)
        {
            //清除用Clear方法
            uiMCLayoutPanel1.Controls.Clear();
            foreach (var camera in GlobalVar.dicCameras.Values)
            {
                camera.CloseDevice();
            }
            GlobalVar.dicCameras.Clear();
        }
        private void LoadFlowEvent(UserItem flow)
        {
            //按键1为测试
            flow.MenuItem1ClickedEvent += MCEvent;
            //按键2为刷新
            flow.MenuItem2ClickedEvent += ReconnectEvent;
            //按键3为移除
            flow.MenuItem3ClickedEvent += DeleteEvent;
        }
        private void RemoveFlowEvent(UserItem flow)
        {
            //按键1为测试
            flow.MenuItem1ClickedEvent -= MCEvent;
            //按键2为刷新
            flow.MenuItem2ClickedEvent -= ReconnectEvent;
            //按键3为移除
            flow.MenuItem3ClickedEvent -= DeleteEvent;
        }
        // è¿åŠ¨æŽ§åˆ¶
        private void MCEvent(string Name, string Text)
        {
            for (int i = 0; i < uiMCLayoutPanel1.Controls.Count; i++)
            {
                UserItem flow = (UserItem)uiMCLayoutPanel1.Controls[i];
                string name = flow.Name;
                if (name != Name)
                    continue;
                if (GlobalVar.dicCameras.ContainsKey(name))
                {
                    MotionControlPage.MotionControlForm cameraForm = new MotionControlPage.MotionControlForm(GlobalVar.dicCameras[name]);
                    cameraForm.Show();
                }
            }
        }
        // ç§»é™¤ç›¸æœº
        private void DeleteEvent(string Name, string Text)
        {
            for (int i = 0; i < uiMCLayoutPanel1.Controls.Count; i++)
            {
                UserItem flow = (UserItem)uiMCLayoutPanel1.Controls[i];
                string name = flow.Name;
                if (name != Name)
                    continue;
                RemoveFlowEvent(flow);
                uiMCLayoutPanel1.Controls.Remove(uiMCLayoutPanel1.Controls[i]);
                if (GlobalVar.dicCameras.TryRemove(name, out BaseCamera BaseCamera))
                {
                    BaseCamera.Dispose();
                    LogInfo?.Invoke(string.Format("移除相机[{0}]", name), LogInfoType.INFO);
                }
                else
                    LogInfo?.Invoke(string.Format("移除相机[{0}]失败", name), LogInfoType.ERROR);
            }
        }
        // é‡è¿žç›¸æœº
        private void ReconnectEvent(string Name, string Text)
        {
            for (int i = 0; i < uiMCLayoutPanel1.Controls.Count; i++)
            {
                UserItem flow = (UserItem)uiMCLayoutPanel1.Controls[i];
                string name = flow.Name;
                if (name != Name)
                    continue;
                GlobalVar.dicCameras[name].CloseDevice();
                Thread.Sleep(50);
                GlobalVar.dicCameras[name].InitDevice(name, this.Handle);
                if (GlobalVar.dicCameras[name].isGrabbing)
                {
                    flow.state = State.Pass;
                    LogInfo?.Invoke(string.Format("重连相机[{0}]成功", name), LogInfoType.PASS);
                }
                else
                {
                    flow.state = State.Error;
                    LogInfo?.Invoke(string.Format("重连相机[{0}]失败", name), LogInfoType.ERROR);
                }
                flow.Refresh();
            }
        }
    }
}
LB_SmartVision/Forms/Pages/MotionControlPage/MotionControlForm.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,781 @@
namespace LB_SmartVision.Forms.Pages.MotionControlPage
{
    partial class MotionControlForm
    {
        /// <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(MotionControlForm));
            uiGroupBoxMotionControl = new GroupBox();
            tableLayoutPanel3 = new TableLayoutPanel();
            tableLayoutPanel6 = new TableLayoutPanel();
            uiButtonCloseSoftGrab = new Button();
            uiButtonHardGrabWithPLC = new Button();
            tableLayoutPanel5 = new TableLayoutPanel();
            uiButtonGrabOnce = new Button();
            tableLayoutPanel4 = new TableLayoutPanel();
            labelPointSpeed = new Label();
            textBoxAngleNow = new TextBox();
            labelAngleNow = new Label();
            textBoxPositionNow = new TextBox();
            labelPositionNow = new Label();
            textBoxAngSpeed = new TextBox();
            labelAngSpeed = new Label();
            textBoxPointSpeed = new TextBox();
            tableLayoutPanel2 = new TableLayoutPanel();
            uiButtonIncreasePitchAngle = new Button();
            groupBoxPitchAnglePosition = new GroupBox();
            textBoxPitchAnglePosition = new TextBox();
            uiButtonDecreasePitchAngle = new Button();
            groupBoxZPosition = new GroupBox();
            textBoxZPosition = new TextBox();
            groupBoxYPosition = new GroupBox();
            textBoxYPosition = new TextBox();
            uiButtonIncreaseZ = new Button();
            uiButtonDecreaseZ = new Button();
            uiButtonIncreaseY = new Button();
            uiButtonDecreaseY = new Button();
            uiButtonIncreaseX = new Button();
            uiButtonDecreaseX = new Button();
            groupBoxXPosition = new GroupBox();
            textBoxXPosition = new TextBox();
            tableLayoutPanel1 = new TableLayoutPanel();
            textBox1 = new TextBox();
            uiMarkLabelSN = new Label();
            tableLayoutPanel7 = new TableLayoutPanel();
            textBox2 = new TextBox();
            uiMarkLabelName = new Label();
            uiGroupBoxImage = new GroupBox();
            uiSplitContainer1 = new SplitContainer();
            themeForm1 = new ReaLTaiizor.Forms.ThemeForm();
            controlBox1 = new ReaLTaiizor.Controls.ControlBox();
            uiGroupBoxMotionControl.SuspendLayout();
            tableLayoutPanel3.SuspendLayout();
            tableLayoutPanel6.SuspendLayout();
            tableLayoutPanel5.SuspendLayout();
            tableLayoutPanel4.SuspendLayout();
            tableLayoutPanel2.SuspendLayout();
            groupBoxPitchAnglePosition.SuspendLayout();
            groupBoxZPosition.SuspendLayout();
            groupBoxYPosition.SuspendLayout();
            groupBoxXPosition.SuspendLayout();
            tableLayoutPanel1.SuspendLayout();
            tableLayoutPanel7.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)uiSplitContainer1).BeginInit();
            uiSplitContainer1.Panel1.SuspendLayout();
            uiSplitContainer1.Panel2.SuspendLayout();
            uiSplitContainer1.SuspendLayout();
            themeForm1.SuspendLayout();
            SuspendLayout();
            //
            // uiGroupBoxMotionControl
            //
            uiGroupBoxMotionControl.Controls.Add(tableLayoutPanel3);
            uiGroupBoxMotionControl.Font = new Font("宋体", 12F);
            uiGroupBoxMotionControl.ForeColor = SystemColors.Control;
            uiGroupBoxMotionControl.Location = new Point(0, 0);
            uiGroupBoxMotionControl.Margin = new Padding(4, 5, 4, 5);
            uiGroupBoxMotionControl.MinimumSize = new Size(1, 1);
            uiGroupBoxMotionControl.Name = "uiGroupBoxMotionControl";
            uiGroupBoxMotionControl.Padding = new Padding(0, 32, 0, 0);
            uiGroupBoxMotionControl.Size = new Size(374, 624);
            uiGroupBoxMotionControl.TabIndex = 18;
            uiGroupBoxMotionControl.TabStop = false;
            uiGroupBoxMotionControl.Text = "运动控制参数";
            //
            // tableLayoutPanel3
            //
            tableLayoutPanel3.ColumnCount = 1;
            tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
            tableLayoutPanel3.Controls.Add(tableLayoutPanel6, 0, 3);
            tableLayoutPanel3.Controls.Add(tableLayoutPanel5, 0, 2);
            tableLayoutPanel3.Controls.Add(tableLayoutPanel4, 0, 5);
            tableLayoutPanel3.Controls.Add(tableLayoutPanel2, 0, 4);
            tableLayoutPanel3.Controls.Add(tableLayoutPanel1, 0, 0);
            tableLayoutPanel3.Controls.Add(tableLayoutPanel7, 0, 1);
            tableLayoutPanel3.Location = new Point(0, 55);
            tableLayoutPanel3.Name = "tableLayoutPanel3";
            tableLayoutPanel3.RowCount = 6;
            tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F));
            tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F));
            tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F));
            tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F));
            tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
            tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
            tableLayoutPanel3.Size = new Size(374, 560);
            tableLayoutPanel3.TabIndex = 0;
            tableLayoutPanel3.Paint += tableLayoutPanel3_Paint;
            //
            // tableLayoutPanel6
            //
            tableLayoutPanel6.ColumnCount = 2;
            tableLayoutPanel6.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
            tableLayoutPanel6.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
            tableLayoutPanel6.Controls.Add(uiButtonCloseSoftGrab, 1, 0);
            tableLayoutPanel6.Controls.Add(uiButtonHardGrabWithPLC, 0, 0);
            tableLayoutPanel6.Dock = DockStyle.Fill;
            tableLayoutPanel6.Location = new Point(3, 138);
            tableLayoutPanel6.Name = "tableLayoutPanel6";
            tableLayoutPanel6.RowCount = 1;
            tableLayoutPanel6.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
            tableLayoutPanel6.Size = new Size(368, 39);
            tableLayoutPanel6.TabIndex = 6;
            //
            // uiButtonCloseSoftGrab
            //
            uiButtonCloseSoftGrab.Anchor = AnchorStyles.None;
            uiButtonCloseSoftGrab.BackColor = Color.Black;
            uiButtonCloseSoftGrab.Location = new Point(225, 5);
            uiButtonCloseSoftGrab.Name = "uiButtonCloseSoftGrab";
            uiButtonCloseSoftGrab.Size = new Size(102, 29);
            uiButtonCloseSoftGrab.TabIndex = 2;
            uiButtonCloseSoftGrab.Text = "暂停采集";
            uiButtonCloseSoftGrab.UseVisualStyleBackColor = false;
            //
            // uiButtonHardGrabWithPLC
            //
            uiButtonHardGrabWithPLC.Anchor = AnchorStyles.None;
            uiButtonHardGrabWithPLC.BackColor = Color.Black;
            uiButtonHardGrabWithPLC.Location = new Point(41, 5);
            uiButtonHardGrabWithPLC.Name = "uiButtonHardGrabWithPLC";
            uiButtonHardGrabWithPLC.Size = new Size(102, 29);
            uiButtonHardGrabWithPLC.TabIndex = 1;
            uiButtonHardGrabWithPLC.Text = "模拟采集";
            uiButtonHardGrabWithPLC.UseVisualStyleBackColor = false;
            uiButtonHardGrabWithPLC.Click += uiButtonHardGrabWithPLC_Click;
            //
            // tableLayoutPanel5
            //
            tableLayoutPanel5.ColumnCount = 1;
            tableLayoutPanel5.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
            tableLayoutPanel5.Controls.Add(uiButtonGrabOnce, 0, 0);
            tableLayoutPanel5.Dock = DockStyle.Fill;
            tableLayoutPanel5.Location = new Point(3, 93);
            tableLayoutPanel5.Name = "tableLayoutPanel5";
            tableLayoutPanel5.RowCount = 1;
            tableLayoutPanel5.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
            tableLayoutPanel5.Size = new Size(368, 39);
            tableLayoutPanel5.TabIndex = 5;
            //
            // uiButtonGrabOnce
            //
            uiButtonGrabOnce.BackColor = Color.Black;
            uiButtonGrabOnce.Dock = DockStyle.Fill;
            uiButtonGrabOnce.Location = new Point(3, 3);
            uiButtonGrabOnce.Name = "uiButtonGrabOnce";
            uiButtonGrabOnce.Size = new Size(362, 33);
            uiButtonGrabOnce.TabIndex = 0;
            uiButtonGrabOnce.Text = "单张采集";
            uiButtonGrabOnce.UseVisualStyleBackColor = false;
            uiButtonGrabOnce.Click += uiButtonGrabOnce_Click;
            //
            // tableLayoutPanel4
            //
            tableLayoutPanel4.ColumnCount = 2;
            tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 42.81768F));
            tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 57.18232F));
            tableLayoutPanel4.Controls.Add(labelPointSpeed, 0, 0);
            tableLayoutPanel4.Controls.Add(textBoxAngleNow, 1, 3);
            tableLayoutPanel4.Controls.Add(labelAngleNow, 0, 3);
            tableLayoutPanel4.Controls.Add(textBoxPositionNow, 1, 2);
            tableLayoutPanel4.Controls.Add(labelPositionNow, 0, 2);
            tableLayoutPanel4.Controls.Add(textBoxAngSpeed, 1, 1);
            tableLayoutPanel4.Controls.Add(labelAngSpeed, 0, 1);
            tableLayoutPanel4.Controls.Add(textBoxPointSpeed, 1, 0);
            tableLayoutPanel4.Dock = DockStyle.Fill;
            tableLayoutPanel4.Location = new Point(3, 373);
            tableLayoutPanel4.Name = "tableLayoutPanel4";
            tableLayoutPanel4.RowCount = 4;
            tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F));
            tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F));
            tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F));
            tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F));
            tableLayoutPanel4.Size = new Size(368, 184);
            tableLayoutPanel4.TabIndex = 2;
            //
            // labelPointSpeed
            //
            labelPointSpeed.AutoSize = true;
            labelPointSpeed.Dock = DockStyle.Fill;
            labelPointSpeed.Location = new Point(3, 5);
            labelPointSpeed.Margin = new Padding(3, 5, 3, 5);
            labelPointSpeed.Name = "labelPointSpeed";
            labelPointSpeed.Size = new Size(151, 35);
            labelPointSpeed.TabIndex = 18;
            labelPointSpeed.Text = "点动速度(mm/s)";
            labelPointSpeed.TextAlign = ContentAlignment.MiddleLeft;
            //
            // textBoxAngleNow
            //
            textBoxAngleNow.Anchor = AnchorStyles.Left | AnchorStyles.Right;
            textBoxAngleNow.Enabled = false;
            textBoxAngleNow.Location = new Point(160, 146);
            textBoxAngleNow.Name = "textBoxAngleNow";
            textBoxAngleNow.Size = new Size(205, 26);
            textBoxAngleNow.TabIndex = 17;
            textBoxAngleNow.Text = "0";
            textBoxAngleNow.TextChanged += textBoxAngleNow_TextChanged;
            //
            // labelAngleNow
            //
            labelAngleNow.AutoSize = true;
            labelAngleNow.Dock = DockStyle.Fill;
            labelAngleNow.Location = new Point(3, 140);
            labelAngleNow.Margin = new Padding(3, 5, 3, 5);
            labelAngleNow.Name = "labelAngleNow";
            labelAngleNow.Size = new Size(151, 39);
            labelAngleNow.TabIndex = 16;
            labelAngleNow.Text = "当前角度(°)";
            labelAngleNow.TextAlign = ContentAlignment.MiddleLeft;
            //
            // textBoxPositionNow
            //
            textBoxPositionNow.Anchor = AnchorStyles.Left | AnchorStyles.Right;
            textBoxPositionNow.Enabled = false;
            textBoxPositionNow.Location = new Point(160, 99);
            textBoxPositionNow.Name = "textBoxPositionNow";
            textBoxPositionNow.Size = new Size(205, 26);
            textBoxPositionNow.TabIndex = 15;
            textBoxPositionNow.Text = "(0,0,0)";
            textBoxPositionNow.TextChanged += textBoxPositionNow_TextChanged;
            //
            // labelPositionNow
            //
            labelPositionNow.AutoSize = true;
            labelPositionNow.Dock = DockStyle.Fill;
            labelPositionNow.Location = new Point(3, 95);
            labelPositionNow.Margin = new Padding(3, 5, 3, 5);
            labelPositionNow.Name = "labelPositionNow";
            labelPositionNow.Size = new Size(151, 35);
            labelPositionNow.TabIndex = 14;
            labelPositionNow.Text = "当前点位(mm)";
            labelPositionNow.TextAlign = ContentAlignment.MiddleLeft;
            //
            // textBoxAngSpeed
            //
            textBoxAngSpeed.Anchor = AnchorStyles.Left | AnchorStyles.Right;
            textBoxAngSpeed.Location = new Point(160, 54);
            textBoxAngSpeed.Name = "textBoxAngSpeed";
            textBoxAngSpeed.Size = new Size(205, 26);
            textBoxAngSpeed.TabIndex = 13;
            textBoxAngSpeed.Text = "0";
            textBoxAngSpeed.TextChanged += textBoxAngSpeed_TextChanged;
            textBoxAngSpeed.KeyDown += textBoxXPosition_KeyDown;
            textBoxAngSpeed.KeyPress += textBoxXPosition_KeyPress;
            //
            // labelAngSpeed
            //
            labelAngSpeed.AutoSize = true;
            labelAngSpeed.Dock = DockStyle.Fill;
            labelAngSpeed.Location = new Point(3, 50);
            labelAngSpeed.Margin = new Padding(3, 5, 3, 5);
            labelAngSpeed.Name = "labelAngSpeed";
            labelAngSpeed.Size = new Size(151, 35);
            labelAngSpeed.TabIndex = 12;
            labelAngSpeed.Text = "角速度(rad/s)";
            labelAngSpeed.TextAlign = ContentAlignment.MiddleLeft;
            //
            // textBoxPointSpeed
            //
            textBoxPointSpeed.Anchor = AnchorStyles.Left | AnchorStyles.Right;
            textBoxPointSpeed.Location = new Point(160, 9);
            textBoxPointSpeed.Name = "textBoxPointSpeed";
            textBoxPointSpeed.Size = new Size(205, 26);
            textBoxPointSpeed.TabIndex = 11;
            textBoxPointSpeed.Text = "0";
            textBoxPointSpeed.TextChanged += textBoxPointSpeed_TextChanged;
            textBoxPointSpeed.KeyDown += textBoxXPosition_KeyDown;
            textBoxPointSpeed.KeyPress += textBoxXPosition_KeyPress;
            //
            // tableLayoutPanel2
            //
            tableLayoutPanel2.ColumnCount = 3;
            tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
            tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60F));
            tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
            tableLayoutPanel2.Controls.Add(uiButtonIncreasePitchAngle, 2, 3);
            tableLayoutPanel2.Controls.Add(groupBoxPitchAnglePosition, 1, 3);
            tableLayoutPanel2.Controls.Add(uiButtonDecreasePitchAngle, 0, 3);
            tableLayoutPanel2.Controls.Add(groupBoxZPosition, 1, 2);
            tableLayoutPanel2.Controls.Add(groupBoxYPosition, 1, 1);
            tableLayoutPanel2.Controls.Add(uiButtonIncreaseZ, 2, 2);
            tableLayoutPanel2.Controls.Add(uiButtonDecreaseZ, 0, 2);
            tableLayoutPanel2.Controls.Add(uiButtonIncreaseY, 2, 1);
            tableLayoutPanel2.Controls.Add(uiButtonDecreaseY, 0, 1);
            tableLayoutPanel2.Controls.Add(uiButtonIncreaseX, 2, 0);
            tableLayoutPanel2.Controls.Add(uiButtonDecreaseX, 0, 0);
            tableLayoutPanel2.Controls.Add(groupBoxXPosition, 1, 0);
            tableLayoutPanel2.Dock = DockStyle.Fill;
            tableLayoutPanel2.Location = new Point(3, 183);
            tableLayoutPanel2.Name = "tableLayoutPanel2";
            tableLayoutPanel2.RowCount = 1;
            tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F));
            tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F));
            tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F));
            tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F));
            tableLayoutPanel2.Size = new Size(368, 184);
            tableLayoutPanel2.TabIndex = 3;
            //
            // uiButtonIncreasePitchAngle
            //
            uiButtonIncreasePitchAngle.BackColor = Color.Black;
            uiButtonIncreasePitchAngle.Dock = DockStyle.Left;
            uiButtonIncreasePitchAngle.Location = new Point(298, 140);
            uiButtonIncreasePitchAngle.Margin = new Padding(5);
            uiButtonIncreasePitchAngle.Name = "uiButtonIncreasePitchAngle";
            uiButtonIncreasePitchAngle.Size = new Size(32, 39);
            uiButtonIncreasePitchAngle.TabIndex = 27;
            uiButtonIncreasePitchAngle.Text = "+";
            uiButtonIncreasePitchAngle.UseVisualStyleBackColor = false;
            uiButtonIncreasePitchAngle.Click += uiButtonIncreasePitchAngle_Click;
            //
            // groupBoxPitchAnglePosition
            //
            groupBoxPitchAnglePosition.Controls.Add(textBoxPitchAnglePosition);
            groupBoxPitchAnglePosition.Font = new Font("宋体", 8F);
            groupBoxPitchAnglePosition.ForeColor = Color.White;
            groupBoxPitchAnglePosition.Location = new Point(123, 138);
            groupBoxPitchAnglePosition.Margin = new Padding(50, 3, 3, 3);
            groupBoxPitchAnglePosition.Name = "groupBoxPitchAnglePosition";
            groupBoxPitchAnglePosition.Size = new Size(115, 39);
            groupBoxPitchAnglePosition.TabIndex = 26;
            groupBoxPitchAnglePosition.TabStop = false;
            groupBoxPitchAnglePosition.Text = "俯仰角(°)";
            //
            // textBoxPitchAnglePosition
            //
            textBoxPitchAnglePosition.Dock = DockStyle.Bottom;
            textBoxPitchAnglePosition.Font = new Font("宋体", 10F);
            textBoxPitchAnglePosition.Location = new Point(3, 16);
            textBoxPitchAnglePosition.Multiline = true;
            textBoxPitchAnglePosition.Name = "textBoxPitchAnglePosition";
            textBoxPitchAnglePosition.Size = new Size(109, 20);
            textBoxPitchAnglePosition.TabIndex = 13;
            textBoxPitchAnglePosition.Text = "1";
            textBoxPitchAnglePosition.KeyDown += textBoxXPosition_KeyDown;
            textBoxPitchAnglePosition.KeyPress += textBoxXPosition_KeyPress;
            //
            // uiButtonDecreasePitchAngle
            //
            uiButtonDecreasePitchAngle.BackColor = Color.Black;
            uiButtonDecreasePitchAngle.Dock = DockStyle.Right;
            uiButtonDecreasePitchAngle.Location = new Point(37, 140);
            uiButtonDecreasePitchAngle.Margin = new Padding(5);
            uiButtonDecreasePitchAngle.Name = "uiButtonDecreasePitchAngle";
            uiButtonDecreasePitchAngle.Size = new Size(31, 39);
            uiButtonDecreasePitchAngle.TabIndex = 25;
            uiButtonDecreasePitchAngle.Text = "-";
            uiButtonDecreasePitchAngle.UseVisualStyleBackColor = false;
            uiButtonDecreasePitchAngle.Click += uiButtonDecreasePitchAngle_Click;
            //
            // groupBoxZPosition
            //
            groupBoxZPosition.Controls.Add(textBoxZPosition);
            groupBoxZPosition.Font = new Font("宋体", 8F);
            groupBoxZPosition.ForeColor = Color.White;
            groupBoxZPosition.Location = new Point(123, 93);
            groupBoxZPosition.Margin = new Padding(50, 3, 3, 3);
            groupBoxZPosition.Name = "groupBoxZPosition";
            groupBoxZPosition.Size = new Size(115, 39);
            groupBoxZPosition.TabIndex = 24;
            groupBoxZPosition.TabStop = false;
            groupBoxZPosition.Text = "Z(mm)";
            //
            // textBoxZPosition
            //
            textBoxZPosition.Dock = DockStyle.Bottom;
            textBoxZPosition.Font = new Font("宋体", 10F);
            textBoxZPosition.Location = new Point(3, 16);
            textBoxZPosition.Multiline = true;
            textBoxZPosition.Name = "textBoxZPosition";
            textBoxZPosition.Size = new Size(109, 20);
            textBoxZPosition.TabIndex = 13;
            textBoxZPosition.Text = "1";
            textBoxZPosition.KeyDown += textBoxXPosition_KeyDown;
            textBoxZPosition.KeyPress += textBoxXPosition_KeyPress;
            //
            // groupBoxYPosition
            //
            groupBoxYPosition.Controls.Add(textBoxYPosition);
            groupBoxYPosition.Font = new Font("宋体", 8F);
            groupBoxYPosition.ForeColor = Color.White;
            groupBoxYPosition.Location = new Point(123, 48);
            groupBoxYPosition.Margin = new Padding(50, 3, 3, 3);
            groupBoxYPosition.Name = "groupBoxYPosition";
            groupBoxYPosition.Size = new Size(115, 39);
            groupBoxYPosition.TabIndex = 23;
            groupBoxYPosition.TabStop = false;
            groupBoxYPosition.Text = "Y(mm)";
            //
            // textBoxYPosition
            //
            textBoxYPosition.Dock = DockStyle.Bottom;
            textBoxYPosition.Font = new Font("宋体", 10F);
            textBoxYPosition.Location = new Point(3, 16);
            textBoxYPosition.Multiline = true;
            textBoxYPosition.Name = "textBoxYPosition";
            textBoxYPosition.Size = new Size(109, 20);
            textBoxYPosition.TabIndex = 13;
            textBoxYPosition.Text = "1";
            textBoxYPosition.KeyDown += textBoxXPosition_KeyDown;
            textBoxYPosition.KeyPress += textBoxXPosition_KeyPress;
            //
            // uiButtonIncreaseZ
            //
            uiButtonIncreaseZ.BackColor = Color.Black;
            uiButtonIncreaseZ.Dock = DockStyle.Left;
            uiButtonIncreaseZ.Location = new Point(298, 95);
            uiButtonIncreaseZ.Margin = new Padding(5);
            uiButtonIncreaseZ.Name = "uiButtonIncreaseZ";
            uiButtonIncreaseZ.Size = new Size(32, 35);
            uiButtonIncreaseZ.TabIndex = 19;
            uiButtonIncreaseZ.Text = "+";
            uiButtonIncreaseZ.UseVisualStyleBackColor = false;
            uiButtonIncreaseZ.Click += uiButtonIncreaseZ_Click;
            //
            // uiButtonDecreaseZ
            //
            uiButtonDecreaseZ.BackColor = Color.Black;
            uiButtonDecreaseZ.Dock = DockStyle.Right;
            uiButtonDecreaseZ.Location = new Point(37, 95);
            uiButtonDecreaseZ.Margin = new Padding(5);
            uiButtonDecreaseZ.Name = "uiButtonDecreaseZ";
            uiButtonDecreaseZ.Size = new Size(31, 35);
            uiButtonDecreaseZ.TabIndex = 17;
            uiButtonDecreaseZ.Text = "-";
            uiButtonDecreaseZ.UseVisualStyleBackColor = false;
            uiButtonDecreaseZ.Click += uiButtonDecreaseZ_Click;
            //
            // uiButtonIncreaseY
            //
            uiButtonIncreaseY.BackColor = Color.Black;
            uiButtonIncreaseY.Dock = DockStyle.Left;
            uiButtonIncreaseY.Location = new Point(298, 50);
            uiButtonIncreaseY.Margin = new Padding(5);
            uiButtonIncreaseY.Name = "uiButtonIncreaseY";
            uiButtonIncreaseY.Size = new Size(32, 35);
            uiButtonIncreaseY.TabIndex = 16;
            uiButtonIncreaseY.Text = "+";
            uiButtonIncreaseY.UseVisualStyleBackColor = false;
            uiButtonIncreaseY.Click += uiButtonIncreaseY_Click;
            //
            // uiButtonDecreaseY
            //
            uiButtonDecreaseY.BackColor = Color.Black;
            uiButtonDecreaseY.Dock = DockStyle.Right;
            uiButtonDecreaseY.Location = new Point(37, 50);
            uiButtonDecreaseY.Margin = new Padding(5);
            uiButtonDecreaseY.Name = "uiButtonDecreaseY";
            uiButtonDecreaseY.Size = new Size(31, 35);
            uiButtonDecreaseY.TabIndex = 14;
            uiButtonDecreaseY.Text = "-";
            uiButtonDecreaseY.UseVisualStyleBackColor = false;
            uiButtonDecreaseY.Click += uiButtonDecreaseY_Click;
            //
            // uiButtonIncreaseX
            //
            uiButtonIncreaseX.BackColor = Color.Black;
            uiButtonIncreaseX.Dock = DockStyle.Left;
            uiButtonIncreaseX.Location = new Point(298, 5);
            uiButtonIncreaseX.Margin = new Padding(5);
            uiButtonIncreaseX.Name = "uiButtonIncreaseX";
            uiButtonIncreaseX.Size = new Size(32, 35);
            uiButtonIncreaseX.TabIndex = 10;
            uiButtonIncreaseX.Text = "+";
            uiButtonIncreaseX.UseVisualStyleBackColor = false;
            uiButtonIncreaseX.Click += uiButtonIncreaseX_Click;
            //
            // uiButtonDecreaseX
            //
            uiButtonDecreaseX.BackColor = Color.Black;
            uiButtonDecreaseX.Dock = DockStyle.Right;
            uiButtonDecreaseX.Location = new Point(37, 5);
            uiButtonDecreaseX.Margin = new Padding(5);
            uiButtonDecreaseX.Name = "uiButtonDecreaseX";
            uiButtonDecreaseX.Size = new Size(31, 35);
            uiButtonDecreaseX.TabIndex = 8;
            uiButtonDecreaseX.Text = "-";
            uiButtonDecreaseX.UseVisualStyleBackColor = false;
            uiButtonDecreaseX.Click += uiButtonDecreaseX_Click;
            //
            // groupBoxXPosition
            //
            groupBoxXPosition.Controls.Add(textBoxXPosition);
            groupBoxXPosition.Font = new Font("宋体", 8F);
            groupBoxXPosition.ForeColor = Color.White;
            groupBoxXPosition.Location = new Point(123, 3);
            groupBoxXPosition.Margin = new Padding(50, 3, 3, 3);
            groupBoxXPosition.Name = "groupBoxXPosition";
            groupBoxXPosition.Size = new Size(115, 39);
            groupBoxXPosition.TabIndex = 21;
            groupBoxXPosition.TabStop = false;
            groupBoxXPosition.Text = "X(mm)";
            //
            // textBoxXPosition
            //
            textBoxXPosition.Dock = DockStyle.Bottom;
            textBoxXPosition.Font = new Font("宋体", 10F);
            textBoxXPosition.Location = new Point(3, 16);
            textBoxXPosition.Multiline = true;
            textBoxXPosition.Name = "textBoxXPosition";
            textBoxXPosition.Size = new Size(109, 20);
            textBoxXPosition.TabIndex = 12;
            textBoxXPosition.Text = "1";
            textBoxXPosition.KeyDown += textBoxXPosition_KeyDown;
            textBoxXPosition.KeyPress += textBoxXPosition_KeyPress;
            //
            // tableLayoutPanel1
            //
            tableLayoutPanel1.ColumnCount = 2;
            tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 75F));
            tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
            tableLayoutPanel1.Controls.Add(textBox1, 1, 0);
            tableLayoutPanel1.Controls.Add(uiMarkLabelSN, 0, 0);
            tableLayoutPanel1.Dock = DockStyle.Fill;
            tableLayoutPanel1.Location = new Point(3, 3);
            tableLayoutPanel1.Name = "tableLayoutPanel1";
            tableLayoutPanel1.RowCount = 1;
            tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
            tableLayoutPanel1.Size = new Size(368, 39);
            tableLayoutPanel1.TabIndex = 4;
            //
            // textBox1
            //
            textBox1.Anchor = AnchorStyles.Left | AnchorStyles.Right;
            textBox1.Enabled = false;
            textBox1.Location = new Point(78, 6);
            textBox1.Name = "textBox1";
            textBox1.Size = new Size(287, 26);
            textBox1.TabIndex = 20;
            //
            // uiMarkLabelSN
            //
            uiMarkLabelSN.AutoSize = true;
            uiMarkLabelSN.Dock = DockStyle.Fill;
            uiMarkLabelSN.Location = new Point(3, 5);
            uiMarkLabelSN.Margin = new Padding(3, 5, 3, 5);
            uiMarkLabelSN.Name = "uiMarkLabelSN";
            uiMarkLabelSN.Size = new Size(69, 29);
            uiMarkLabelSN.TabIndex = 19;
            uiMarkLabelSN.Text = "SN";
            uiMarkLabelSN.TextAlign = ContentAlignment.MiddleLeft;
            //
            // tableLayoutPanel7
            //
            tableLayoutPanel7.ColumnCount = 2;
            tableLayoutPanel7.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 75F));
            tableLayoutPanel7.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
            tableLayoutPanel7.Controls.Add(textBox2, 1, 0);
            tableLayoutPanel7.Controls.Add(uiMarkLabelName, 0, 0);
            tableLayoutPanel7.Dock = DockStyle.Fill;
            tableLayoutPanel7.Location = new Point(3, 48);
            tableLayoutPanel7.Name = "tableLayoutPanel7";
            tableLayoutPanel7.RowCount = 1;
            tableLayoutPanel7.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
            tableLayoutPanel7.Size = new Size(368, 39);
            tableLayoutPanel7.TabIndex = 7;
            //
            // textBox2
            //
            textBox2.Anchor = AnchorStyles.Left | AnchorStyles.Right;
            textBox2.Enabled = false;
            textBox2.Location = new Point(78, 6);
            textBox2.Name = "textBox2";
            textBox2.Size = new Size(287, 26);
            textBox2.TabIndex = 21;
            //
            // uiMarkLabelName
            //
            uiMarkLabelName.Anchor = AnchorStyles.None;
            uiMarkLabelName.Location = new Point(3, 5);
            uiMarkLabelName.Margin = new Padding(3, 5, 3, 5);
            uiMarkLabelName.Name = "uiMarkLabelName";
            uiMarkLabelName.Size = new Size(69, 29);
            uiMarkLabelName.TabIndex = 20;
            uiMarkLabelName.Text = "名称";
            uiMarkLabelName.TextAlign = ContentAlignment.MiddleLeft;
            uiMarkLabelName.Click += label1_Click;
            //
            // uiGroupBoxImage
            //
            uiGroupBoxImage.Dock = DockStyle.Fill;
            uiGroupBoxImage.Font = new Font("宋体", 12F);
            uiGroupBoxImage.ForeColor = SystemColors.Control;
            uiGroupBoxImage.Location = new Point(0, 0);
            uiGroupBoxImage.Margin = new Padding(4, 5, 4, 5);
            uiGroupBoxImage.MinimumSize = new Size(1, 1);
            uiGroupBoxImage.Name = "uiGroupBoxImage";
            uiGroupBoxImage.Padding = new Padding(0, 32, 0, 0);
            uiGroupBoxImage.Size = new Size(495, 684);
            uiGroupBoxImage.TabIndex = 17;
            uiGroupBoxImage.TabStop = false;
            uiGroupBoxImage.Text = "实时采集";
            //
            // uiSplitContainer1
            //
            uiSplitContainer1.Dock = DockStyle.Fill;
            uiSplitContainer1.ForeColor = SystemColors.Control;
            uiSplitContainer1.Location = new Point(10, 70);
            uiSplitContainer1.MinimumSize = new Size(20, 20);
            uiSplitContainer1.Name = "uiSplitContainer1";
            //
            // uiSplitContainer1.Panel1
            //
            uiSplitContainer1.Panel1.Controls.Add(uiGroupBoxMotionControl);
            uiSplitContainer1.Panel1.Paint += uiSplitContainer1_Panel1_Paint;
            //
            // uiSplitContainer1.Panel2
            //
            uiSplitContainer1.Panel2.Controls.Add(uiGroupBoxImage);
            uiSplitContainer1.Size = new Size(880, 684);
            uiSplitContainer1.SplitterDistance = 374;
            uiSplitContainer1.SplitterWidth = 11;
            uiSplitContainer1.TabIndex = 20;
            //
            // themeForm1
            //
            themeForm1.BackColor = Color.FromArgb(32, 41, 50);
            themeForm1.Controls.Add(controlBox1);
            themeForm1.Controls.Add(uiSplitContainer1);
            themeForm1.Dock = DockStyle.Fill;
            themeForm1.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 0);
            themeForm1.Image = (Image)resources.GetObject("themeForm1.Image");
            themeForm1.Location = new Point(0, 0);
            themeForm1.Name = "themeForm1";
            themeForm1.Padding = new Padding(10, 70, 10, 9);
            themeForm1.RoundCorners = true;
            themeForm1.Sizable = true;
            themeForm1.Size = new Size(900, 763);
            themeForm1.SmartBounds = true;
            themeForm1.StartPosition = FormStartPosition.WindowsDefaultLocation;
            themeForm1.TabIndex = 21;
            themeForm1.Text = "运动控制设置";
            //
            // controlBox1
            //
            controlBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            controlBox1.BackColor = Color.FromArgb(32, 34, 37);
            controlBox1.CloseHoverColor = Color.FromArgb(230, 17, 35);
            controlBox1.DefaultLocation = true;
            controlBox1.EnableHoverHighlight = true;
            controlBox1.EnableMaximizeButton = true;
            controlBox1.EnableMinimizeButton = true;
            controlBox1.ForeColor = Color.FromArgb(155, 155, 155);
            controlBox1.Location = new Point(800, 18);
            controlBox1.MaximizeHoverColor = Color.FromArgb(74, 74, 74);
            controlBox1.MinimizeHoverColor = Color.FromArgb(63, 63, 65);
            controlBox1.Name = "controlBox1";
            controlBox1.Size = new Size(90, 25);
            controlBox1.TabIndex = 21;
            controlBox1.Text = "controlBox1";
            //
            // MotionControlForm
            //
            AutoScaleMode = AutoScaleMode.None;
            AutoSize = true;
            ClientSize = new Size(900, 763);
            Controls.Add(themeForm1);
            FormBorderStyle = FormBorderStyle.None;
            MinimumSize = new Size(261, 61);
            Name = "MotionControlForm";
            Text = "运动控制设置";
            TransparencyKey = Color.Fuchsia;
            uiGroupBoxMotionControl.ResumeLayout(false);
            tableLayoutPanel3.ResumeLayout(false);
            tableLayoutPanel6.ResumeLayout(false);
            tableLayoutPanel5.ResumeLayout(false);
            tableLayoutPanel4.ResumeLayout(false);
            tableLayoutPanel4.PerformLayout();
            tableLayoutPanel2.ResumeLayout(false);
            groupBoxPitchAnglePosition.ResumeLayout(false);
            groupBoxPitchAnglePosition.PerformLayout();
            groupBoxZPosition.ResumeLayout(false);
            groupBoxZPosition.PerformLayout();
            groupBoxYPosition.ResumeLayout(false);
            groupBoxYPosition.PerformLayout();
            groupBoxXPosition.ResumeLayout(false);
            groupBoxXPosition.PerformLayout();
            tableLayoutPanel1.ResumeLayout(false);
            tableLayoutPanel1.PerformLayout();
            tableLayoutPanel7.ResumeLayout(false);
            tableLayoutPanel7.PerformLayout();
            uiSplitContainer1.Panel1.ResumeLayout(false);
            uiSplitContainer1.Panel2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)uiSplitContainer1).EndInit();
            uiSplitContainer1.ResumeLayout(false);
            themeForm1.ResumeLayout(false);
            ResumeLayout(false);
        }
        #endregion
        private GroupBox uiGroupBoxImage;
        private GroupBox uiGroupBoxMotionControl;
        private SplitContainer uiSplitContainer1;
        private TableLayoutPanel tableLayoutPanel7;
        private Label uiMarkLabel5;
        private TextBox uiTextBoxPitchAngle;
        private ReaLTaiizor.Forms.ThemeForm themeForm1;
        private ReaLTaiizor.Controls.ControlBox controlBox1;
        private TableLayoutPanel tableLayoutPanel3;
        private TableLayoutPanel tableLayoutPanel2;
        private Button uiButtonIncreasePitchAngle;
        private GroupBox groupBoxPitchAnglePosition;
        private TextBox textBoxPitchAnglePosition;
        private Button uiButtonDecreasePitchAngle;
        private GroupBox groupBoxZPosition;
        private TextBox textBoxZPosition;
        private GroupBox groupBoxYPosition;
        private TextBox textBoxYPosition;
        private Button uiButtonIncreaseZ;
        private Button uiButtonDecreaseZ;
        private Button uiButtonIncreaseY;
        private Button uiButtonDecreaseY;
        private Button uiButtonIncreaseX;
        private Button uiButtonDecreaseX;
        private GroupBox groupBoxXPosition;
        private TextBox textBoxXPosition;
        private TableLayoutPanel tableLayoutPanel4;
        private Label labelPointSpeed;
        private TextBox textBoxAngleNow;
        private Label labelAngleNow;
        private TextBox textBoxPositionNow;
        private Label labelPositionNow;
        private TextBox textBoxAngSpeed;
        private Label labelAngSpeed;
        private TextBox textBoxPointSpeed;
        private TableLayoutPanel tableLayoutPanel6;
        private Button uiButtonHardGrabWithPLC;
        private TableLayoutPanel tableLayoutPanel5;
        private Button uiButtonGrabOnce;
        private TableLayoutPanel tableLayoutPanel1;
        private TextBox textBox1;
        private Label uiMarkLabelSN;
        private Button uiButtonCloseSoftGrab;
        private Label uiMarkLabelName;
        private TextBox textBox2;
    }
}
LB_SmartVision/Forms/Pages/MotionControlPage/MotionControlForm.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,369 @@
using LB_VisionControl;
using LB_VisionProcesses.Cameras;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
using static ZXing.QrCode.Internal.Mode;
namespace LB_SmartVision.Forms.Pages.MotionControlPage
{
    public partial class MotionControlForm : Form
    {
        BaseCamera camera { get; set; }
        UserPictureBox onlinePictureBox { get; set; }
        public MotionControlForm()
        {
            InitializeComponent();
        }
        public MotionControlForm(BaseCamera camera)
        {
            InitializeComponent();
            if (camera == null)
                return;
            this.camera = camera;
            this.Text = camera.SN;
            textBox1.Text = camera.SN;
            onlinePictureBox = new UserPictureBox(uiGroupBoxImage);
            this.uiGroupBoxImage.Controls.Clear();
            this.uiGroupBoxImage.Controls.Add(onlinePictureBox);
            onlinePictureBox.Dock = DockStyle.Fill;
            //加载回调函数
            Subscribe();
        }
        private void CameraForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (camera == null)
                return;
            camera.StopGrabbing();
            camera.StartGrabbing();
            Unsubscribe();
        }
        public void Unsubscribe()
        {
            try
            {
                if (camera == null)
                    return;
                //取消回调函数
                camera.ImageGrabbed -= GetImageBllComplete;
            }
            catch (Exception ex)
            {
                // è®°å½•错误信息
                Debug.WriteLine($"错误: {ex.Message}");
            }
        }
        public void Subscribe()
        {
            try
            {
                if (camera == null)
                    return;
                //取消回调函数
                camera.ImageGrabbed -= GetImageBllComplete;
                //加载回调函数
                camera.ImageGrabbed += GetImageBllComplete;
            }
            catch (Exception ex)
            {
                // è®°å½•错误信息
                Debug.WriteLine($"错误: {ex.Message}");
            }
        }
        /// <summary>
        /// ç›¸æœºå›žè°ƒè¿è¡Œ
        /// </summary>
        /// <param name="CCDName"></param>
        /// <param name="image"></param>
        private void GetImageBllComplete(object sender, CameraEventArgs e)
        {
            if (e.Bitmap == null)
                return;
            lock (e.Bitmap)
            {
                if (this.InvokeRequired) // æ£€æŸ¥æ˜¯å¦éœ€è¦åœ¨UI线程上调用
                {
                    this.Invoke(new Action(() =>
                    {
                        onlinePictureBox.Image = e.Bitmap;
                    })); // é€’归调用自身,但这次在UI线程上
                }
                else
                {
                    onlinePictureBox.Image = e.Bitmap;
                }
            }
        }
        private void uiButtonGrabOnce_Click(object sender, EventArgs e)
        {
            if (camera == null)
                return;
            Task.Factory.StartNew(() =>
            {
                camera.SetTriggerMode(TriggerMode.On, TriggerSource.Software);
                DateTime startTime = DateTime.Now; // å½“前时间
                camera.GetImageWithSoftTrigger(out Bitmap bitmap);
            });
        }
        private void uiButtonCloseSoftGrab_Click(object sender, EventArgs e)
        {
            if (camera == null)
                return;
            Task.Factory.StartNew(() =>
            {
                camera.StopGrabbing();
                camera.SetTriggerMode(TriggerMode.On, TriggerSource.Software);
                camera.StartGrabbing();
            });
        }
        private void uiButtonHardGrabWithPLC_Click(object sender, EventArgs e)
        {
            if (camera == null)
                return;
            Task.Factory.StartNew(() =>
            {
                camera.SetTriggerMode(TriggerMode.On, TriggerSource.Line0);
                camera.StopGrabbing();
                camera.StartWith_HardTriggerModel();
            });
        }
        private void uiButtonDecreaseX_Click(object sender, EventArgs e)
        {
            float xPosition = 0;
            xPosition = float.Parse(textBoxXPosition.Text);
            MovePosition(-xPosition, 0, 0, 0);
            PositionNow();
        }
        private void uiButtonIncreaseX_Click(object sender, EventArgs e)
        {
            float xPosition = 0;
            xPosition = float.Parse(textBoxXPosition.Text);
            MovePosition(xPosition, 0, 0, 0);
            PositionNow();
        }
        private void uiButtonDecreaseY_Click(object sender, EventArgs e)
        {
            float yPosition = 0;
            yPosition = float.Parse(textBoxYPosition.Text);
            MovePosition(0, -yPosition, 0, 0);
            PositionNow();
        }
        private void uiButtonIncreaseY_Click(object sender, EventArgs e)
        {
            float yPosition = 0;
            yPosition = float.Parse(textBoxYPosition.Text);
            MovePosition(0, yPosition, 0, 0);
            PositionNow();
        }
        private void uiButtonDecreaseZ_Click(object sender, EventArgs e)
        {
            float zPosition = 0;
            zPosition = float.Parse(textBoxZPosition.Text);
            MovePosition(0, 0, -zPosition, 0);
            PositionNow();
        }
        private void uiButtonIncreaseZ_Click(object sender, EventArgs e)
        {
            float zPosition = 0;
            zPosition = float.Parse(textBoxZPosition.Text);
            MovePosition(0, 0, zPosition, 0);
            PositionNow();
        }
        private void uiButtonDecreasePitchAngle_Click(object sender, EventArgs e)
        {
            float pitchanglePosition = 0;
            pitchanglePosition = float.Parse(textBoxPitchAnglePosition.Text);
            MovePosition(0, 0, 0, -pitchanglePosition);
            AngNow();
        }
        private void uiButtonIncreasePitchAngle_Click(object sender, EventArgs e)
        {
            float pitchanglePosition = 0;
            pitchanglePosition = float.Parse(textBoxPitchAnglePosition.Text);
            MovePosition(0, 0, 0, pitchanglePosition);
            AngNow();
        }
        public float XPositionDt;
        public float YPositionDt;
        public float ZPositionDt;
        public float AnglePositionDt;
        public void MovePosition(float fDeltaX, float fDeltaY, float fDeltaZ, float fDeltAngle)
        {
            XPositionDt += fDeltaX;
            YPositionDt += fDeltaY;
            ZPositionDt += fDeltaZ;
            AnglePositionDt += fDeltAngle;
        }
        private void textBoxPointSpeed_TextChanged(object sender, EventArgs e)
        {
            float pointspeed = 0;
            pointspeed = float.Parse(textBoxPointSpeed.Text);
        }
        private void textBoxAngSpeed_TextChanged(object sender, EventArgs e)
        {
            float angspeed = 0;
            angspeed = float.Parse(textBoxAngSpeed.Text);
        }
        private void textBoxPositionNow_TextChanged(object sender, EventArgs e)
        {
            textBoxPositionNow.Enabled = false;
            string x;
            string y;
            string z;
            x = Convert.ToString(Math.Round(XPositionDt, 3));
            y = Convert.ToString(Math.Round(YPositionDt, 3));
            z = Convert.ToString(Math.Round(ZPositionDt, 3));
            textBoxPositionNow.Text = "(" + x + "," + y + "," + z + ")";
        }
        private void textBoxAngleNow_TextChanged(object sender, EventArgs e)
        {
            textBoxAngleNow.Enabled = false;
            string ang;
            ang = Convert.ToString(Math.Round(AnglePositionDt, 3));
            textBoxAngleNow.Text = ang;
        }
        private void PositionNow()
        {
            string x;
            string y;
            string z;
            x = Convert.ToString(Math.Round(XPositionDt, 3));
            y = Convert.ToString(Math.Round(YPositionDt, 3));
            z = Convert.ToString(Math.Round(ZPositionDt, 3));
            textBoxPositionNow.Text = "(" + x + y + z + ")";
        }
        private void AngNow()
        {
            string ang;
            ang = Convert.ToString(Math.Round(AnglePositionDt, 3));
            textBoxAngleNow.Text = "(" + ang + ")";
        }
        private void uiGroupBoxMotionControl_Enter(object sender, EventArgs e)
        {
        }
        private void label1_Click(object sender, EventArgs e)
        {
        }
        private void tableLayoutPanel3_Paint(object sender, PaintEventArgs e)
        {
        }
        private void uiSplitContainer1_Panel1_Paint(object sender, PaintEventArgs e)
        {
        }
        // ä½¿ç”¨KeyDown事件更适合处理回车键
        private void textBoxXPosition_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                //// éªŒè¯è¾“å…¥
                //if (ValidateXPosition())
                //{
                //    // æ‰§è¡Œç¡®è®¤æ“ä½œ
                //    ProcessXPosition();
                //}
                // é˜»æ­¢ç³»ç»Ÿå£°éŸ³å¹¶è®©æ–‡æœ¬æ¡†å¤±åŽ»ç„¦ç‚¹
                e.SuppressKeyPress = true;
                e.Handled = true;
                this.ActiveControl = null;
            }
        }
        // ä½¿ç”¨KeyPress验证实时输入
        private void textBoxXPosition_KeyPress(object sender, KeyPressEventArgs e)
        {
            // å…è®¸å›žè½¦é”®ï¼ˆè™½ç„¶KeyDown会处理它)
            if (e.KeyChar == (char)Keys.Enter)
                return;
            // å…è®¸é€€æ ¼é”®
            if (e.KeyChar == (char)Keys.Back)
                return;
            // åªå…è®¸æ•°å­—
            if (!char.IsDigit(e.KeyChar))
            {
                e.Handled = true;  // é˜»æ­¢è¾“å…¥
            }
        }
        // éªŒè¯æ–¹æ³•
        private bool ValidateXPosition()
        {
            if (string.IsNullOrWhiteSpace(textBoxXPosition.Text))
                return false;
            return Regex.IsMatch(textBoxXPosition.Text, @"^\d+$");
        }
        // å¤„理确认的方法
        private void ProcessXPosition()
        {
            if (int.TryParse(textBoxXPosition.Text, out int xPosition))
            {
                // æ‰§è¡Œé€»è¾‘
                //LogInfo?.Invoke($"X位置已更新为: {xPosition}", LogInfoType.INFO);
            }
        }
    }
}
LB_SmartVision/Forms/Pages/MotionControlPage/MotionControlForm.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,144 @@
<?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>
  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  <data name="themeForm1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    <value>
        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
        YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAPiSURBVFhH7VZLiBxlEG7d+IjBKKtktqt6d8kybLqqZyfi
        +lgUXcGooKIXxYBKLgZFQVDwgQhBvAVzUOPBi3iJgnoSCcTLKobEma7qHeOiuB7UiBo1PuIjq9HNSPX0
        rDN/zyzbQjztB9+pv3r8/19dVZ63ilUUwBzzmbppGOpRcKlEcLNwcGfMsE0J7ogj//okws2NamlD83Zv
        wLX9z2h63ulz7I8kDNsSxleF8CMl+EEY/lDCv5TxbyU8oQTHlfCIEL5kSbh+CqPpeafVIxgWwieUcU4I
        /lTGZl8SnEgI3pBxPzTbOQ4Gkyi4pxEGFTuE639ZpFfNcIsS1LJT5gN28xdl3Cnj/oVmP7t59Hwl3K0M
        C8owL4zbG9XSOjdOT5hQCB5Rxu97BMqT4BsJ4X6Z9M8x+483XXCuEO5KnyjTCOGvSvjMAQ4G3XhdODAV
        rBWGHUL4Wy5Qb34Sk3/rzLS3xuwtCSV8ShmOu1p7wpjwBRkbO8+Nm6LpeQMxwX3Suk43ULczxpPKKLOR
        f+WO7H1bz4YPpaftYdMiLMQET5rWje/FhJfHhF/kjXJcVIZ3tIJVKzazfc3zBpTwLmU82kPfRWH8Lg79
        67qC76uW1mkEr2Qnyxl1GC8K49uNEMbbtpZEjeBaXVnymR/Y2/UUNQqutn/bFTpcVMZ9ykF5ydDzvEMV
        P4wZtYe+L+2Z4hBvSh3YP6rs71zu9PZNGN7tPLnBqloIXl/Oth+F4MW0eO0qlPA9V9BFwtlZhos6g89M
        T69JGB/Xjt+tIDXtG41qaaMwftZDkBG+TAi2tAuuDaHhq4Thq7x+pYSvNRoiL54IJqwy84L05L8LwwPu
        cLFOJ4Rv5vQFKAQ/xRxc1jeB9F0J9rxfHlzfGdxQD2GrJefaFGI7gfrEyJgwfp4X4GEN/Uk3+H5rtQx7
        c/qCFIIjNSpFrcHBcLDro1U94a52i+1EHPoXC+VvrCiF4cNDlY2ltIsJwXOO4KiEOOUGN9jykc7/Hk4L
        kWDPUkuWKLhBGY79+xH32824wQ3WcsWWENdhAdqktG1qyakVWszw1pKI8GW7ma7IGbQydImNYNdpIRLU
        4nDE73JcJ9gihN9mCexuTzkX2dR7TAh+zDleAa0N1wnvdvuKJ5OTZ9j6JQwL1l57jswMM6OjZ8eEN0q6
        I8KnynjMVjKbF1lbPtlq3ykXW1tVuh39LITP992O5suD65XhWSH4QGlo1P3uYr5cPst0thckjLcp473K
        8LBYiyb/0YTwQdsLNYStlnASwRX9amsJaZcL8WkJcXu/OjjlODwVrI0jvOZgZUPJ/fa/wYrEnQGrOBX4
        B6XRFGacFF+7AAAAAElFTkSuQmCC
</value>
  </data>
</root>