瀏覽代碼

修改bug 非模态对话框无法传参

CXS 3 年之前
父節點
當前提交
dbc6bbe2c6

+ 16 - 5
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs

@@ -3209,16 +3209,27 @@ namespace OTSMeasureApp
                     DeleteHoleBSEImageData();
                     break;
                 case "SlopFocusMenuItem":
-                    _5_OTSMeasureStatuImageFun.SlopFocus slopFocus = new _5_OTSMeasureStatuImageFun.SlopFocus();
+                    _5_OTSMeasureStatuImageFun.SlopFocus slopFocus = new _5_OTSMeasureStatuImageFun.SlopFocus(this);
                     slopFocus.Show();
-                    if (slopFocus.result)
-                    {
-                        m_MeasureAppForm.m_ProjParam.GetWorkSample().GetMsrParams().SlopParam = slopFocus.GetCSlopFocusParam();
-                    }
                     
                     break;
             }
         }
+
+        public bool setSlopFocusParam(_5_OTSMeasureStatuImageFun.SlopFocus slopFocus)
+        {
+            if (slopFocus == null)
+            {
+                return false;
+            }
+            else
+            {
+                m_MeasureAppForm.m_ProjParam.GetWorkSample().GetMsrParams().SlopParam = slopFocus.GetCSlopFocusParam();
+                return true;
+            }
+
+        }
+
         protected override bool ProcessDialogKey(Keys keyData)
         {
 

+ 21 - 18
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/SlopFocus.cs

@@ -18,10 +18,12 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
         COTSControlFunExport cfun;
         CSlopFocusParam slopFocusParam;
         bool m_result=false;
+        OTSSamplespaceWindow oTSSamplespaceWindow;
         public bool result {get => m_result; set => m_result = value; }
-    public SlopFocus()
+        public SlopFocus(OTSSamplespaceWindow a_oTSSamplespaceWindow)
         {
             InitializeComponent();
+            oTSSamplespaceWindow = a_oTSSamplespaceWindow;
         }
         public CSlopFocusParam GetCSlopFocusParam()
         {
@@ -54,7 +56,8 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             slopFocusParam.SecondWD = dPW2;
             slopFocusParam.ThirdPoint = new Point(iPX3, iPY3);
             slopFocusParam.ThirdWD = dPW3;
-            m_result=true;
+            oTSSamplespaceWindow.setSlopFocusParam(this);
+            this.Close();
         }
 
         private void SlopFocus_Load(object sender, EventArgs e)
@@ -67,12 +70,12 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
 
         private void bn_FirstPoint_Click(object sender, EventArgs e)
         {
-            //double a, b, c;
-            //a = b = 20;
-            //c = 20;
-            //cfun.SetSemPositionXY(a, b, c);
-            //cfun.SetSemWorkingDistance(c);
-                        double Px = 0;
+            double a, b, c;
+            a = b = 20;
+            c = 20;
+            cfun.SetSemPositionXY(a, b, c);
+            cfun.SetSemWorkingDistance(c);
+            double Px = 0;
             double Py = 0;
             double Pr = 0;
             if(cfun.GetSemPositionXY(ref Px,ref Py,ref Pr))
@@ -89,11 +92,11 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
 
         private void bn_SecondPoint_Click(object sender, EventArgs e)
         {
-            //double a, b, c;
-            //a = b =10;
-            //c = 10;
-            //cfun.SetSemPositionXY(a,b,c);
-            //cfun.SetSemWorkingDistance(c);
+            double a, b, c;
+            a = b = 10;
+            c = 10;
+            cfun.SetSemPositionXY(a, b, c);
+            cfun.SetSemWorkingDistance(c);
 
             double Px = 0;
             double Py = 0;
@@ -113,11 +116,11 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
 
         private void bn_ThirdPoint_Click(object sender, EventArgs e)
         {
-            //double a, b, c;
-            //a = b = 30;
-            //c = 30;
-            //cfun.SetSemPositionXY(a, b, c);
-            //cfun.SetSemWorkingDistance(c);
+            double a, b, c;
+            a = b = 30;
+            c = 30;
+            cfun.SetSemPositionXY(a, b, c);
+            cfun.SetSemWorkingDistance(c);
 
             double Px = 0;
             double Py = 0;