Browse Source

使用MSG在对话框中居中显示。

sat23 3 năm trước cách đây
mục cha
commit
6cb5ec3ebd
2 tập tin đã thay đổi với 16 bổ sung0 xóa
  1. 1 0
      Views/OperationPanel.cs
  2. 15 0
      Views/Verify.cs

+ 1 - 0
Views/OperationPanel.cs

@@ -5126,6 +5126,7 @@ namespace MOKA_Factory_Tools
                 {
                     // 启动NG弹密码框功能;
                     ShowVerifyDelegate(ErrMsg);
+                    Thread.Sleep(300);
                 }
             }
             // 上报抄写结果到MES系统中;

+ 15 - 0
Views/Verify.cs

@@ -20,10 +20,25 @@ namespace MOKA_Factory_Tools
             InitializeComponent();
         }
 
+        /// <summary>
+        /// 设置控件居中显示;
+        /// </summary>
+        /// <param name="ctrl"></param>
+        private void SetControlCenter(Control ctrl)
+        {
+            // 注:由于CSkin控件的标准栏是自定义的,所以整个工作区与系统的对话框是有差别的。
+            int x = (this.Width-ctrl.Width)/2;
+            int y = (this.Height - ctrl.Height)/2;
+            ctrl.Location = new Point(x, y);
+        }
+
         private void Verify_Load(object sender, EventArgs e)
         {
             LB_MSG.Text = _Msg;
             LB_MSG.AutoSize = true;
+
+            // 使控件居中显示;
+              SetControlCenter(LB_MSG);
         }
 
         private void BT_OK_Click(object sender, EventArgs e)