Browse Source

修改 SlopFocus为非模态

CXS 3 years ago
parent
commit
33e9aa4f7c

+ 3 - 2
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs

@@ -3210,11 +3210,12 @@ namespace OTSMeasureApp
                     break;
                 case "SlopFocusMenuItem":
                     _5_OTSMeasureStatuImageFun.SlopFocus slopFocus = new _5_OTSMeasureStatuImageFun.SlopFocus();
-                    DialogResult result = slopFocus.ShowDialog();
-                    if (result == DialogResult.OK)
+                    slopFocus.Show();
+                    if (slopFocus.result)
                     {
                         m_MeasureAppForm.m_ProjParam.GetWorkSample().GetMsrParams().SlopParam = slopFocus.GetCSlopFocusParam();
                     }
+                    
                     break;
             }
         }

+ 8 - 8
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/SlopFocus.Designer.cs

@@ -206,7 +206,7 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             this.groupBox1.Controls.Add(this.tB_FirstPointX);
             this.groupBox1.Controls.Add(this.label3);
             this.groupBox1.Controls.Add(this.tB_FirstPointY);
-            this.groupBox1.Location = new System.Drawing.Point(15, 76);
+            this.groupBox1.Location = new System.Drawing.Point(15, 59);
             this.groupBox1.Name = "groupBox1";
             this.groupBox1.Size = new System.Drawing.Size(749, 89);
             this.groupBox1.TabIndex = 19;
@@ -238,7 +238,7 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             this.groupBox2.Controls.Add(this.tB_SecondPointX);
             this.groupBox2.Controls.Add(this.label4);
             this.groupBox2.Controls.Add(this.bn_SecondPoint);
-            this.groupBox2.Location = new System.Drawing.Point(15, 219);
+            this.groupBox2.Location = new System.Drawing.Point(15, 181);
             this.groupBox2.Name = "groupBox2";
             this.groupBox2.Size = new System.Drawing.Size(749, 95);
             this.groupBox2.TabIndex = 7;
@@ -270,7 +270,7 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             this.groupBox3.Controls.Add(this.tB_ThirdPointX);
             this.groupBox3.Controls.Add(this.tB_ThirdPointY);
             this.groupBox3.Controls.Add(this.label7);
-            this.groupBox3.Location = new System.Drawing.Point(15, 365);
+            this.groupBox3.Location = new System.Drawing.Point(15, 311);
             this.groupBox3.Name = "groupBox3";
             this.groupBox3.Size = new System.Drawing.Size(749, 93);
             this.groupBox3.TabIndex = 13;
@@ -295,7 +295,7 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             // 
             // bn_OK
             // 
-            this.bn_OK.Location = new System.Drawing.Point(667, 486);
+            this.bn_OK.Location = new System.Drawing.Point(667, 428);
             this.bn_OK.Name = "bn_OK";
             this.bn_OK.Size = new System.Drawing.Size(97, 32);
             this.bn_OK.TabIndex = 20;
@@ -305,7 +305,7 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             // 
             // bn_Cancel
             // 
-            this.bn_Cancel.Location = new System.Drawing.Point(537, 486);
+            this.bn_Cancel.Location = new System.Drawing.Point(537, 428);
             this.bn_Cancel.Name = "bn_Cancel";
             this.bn_Cancel.Size = new System.Drawing.Size(91, 32);
             this.bn_Cancel.TabIndex = 21;
@@ -317,7 +317,7 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(773, 525);
+            this.ClientSize = new System.Drawing.Size(773, 482);
             this.ControlBox = false;
             this.Controls.Add(this.bn_Cancel);
             this.Controls.Add(this.bn_OK);
@@ -326,9 +326,9 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             this.Controls.Add(this.groupBox1);
             this.Controls.Add(this.cB_enable);
             this.MaximizeBox = false;
-            this.MaximumSize = new System.Drawing.Size(791, 572);
+            this.MaximumSize = new System.Drawing.Size(791, 529);
             this.MinimizeBox = false;
-            this.MinimumSize = new System.Drawing.Size(791, 572);
+            this.MinimumSize = new System.Drawing.Size(791, 529);
             this.Name = "SlopFocus";
             this.ShowInTaskbar = false;
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;

+ 10 - 4
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/SlopFocus.cs

@@ -16,9 +16,10 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
     public partial class SlopFocus : Form
     {
         COTSControlFunExport cfun;
-        CSlopFocusParam slopFocusParam = new CSlopFocusParam();
-
-        public SlopFocus()
+        CSlopFocusParam slopFocusParam;
+        bool m_result=false;
+        public bool result {get => m_result; set => m_result = value; }
+    public SlopFocus()
         {
             InitializeComponent();
         }
@@ -42,6 +43,10 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
                 MessageBox.Show("Please select different points!");
                 return;
             }
+            if(slopFocusParam==null)
+            {
+                slopFocusParam = new CSlopFocusParam();
+            }
             slopFocusParam.IsUsingSlopParam = cB_enable.Checked;
             slopFocusParam.FirstPoint = new Point(iPX1, iPY1);
             slopFocusParam.FirstWD = dPW1;
@@ -49,7 +54,7 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             slopFocusParam.SecondWD = dPW2;
             slopFocusParam.ThirdPoint = new Point(iPX3, iPY3);
             slopFocusParam.ThirdWD = dPW3;
-            this.DialogResult = DialogResult.OK;
+            m_result=true;
         }
 
         private void SlopFocus_Load(object sender, EventArgs e)
@@ -131,6 +136,7 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
 
         private void bn_Cancel_Click(object sender, EventArgs e)
         {
+            m_result = false;
             this.Close();
         }
     }