Browse Source

自动对焦

HaoShuang 5 years ago
parent
commit
d80bee80ec

+ 1 - 6
AutoDo/AutoDo.csproj

@@ -51,6 +51,7 @@
     </Reference>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Windows.Forms.DataVisualization" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="Microsoft.CSharp" />
@@ -97,12 +98,6 @@
   <ItemGroup>
   <ItemGroup>
     <None Include="App.config" />
     <None Include="App.config" />
   </ItemGroup>
   </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\SmartSEMControl\SmartSEMControl.csproj">
-      <Project>{bf7f80b0-a6da-4470-a331-4c96057fc7fa}</Project>
-      <Name>SmartSEMControl</Name>
-    </ProjectReference>
-  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>
     <PropertyGroup>

+ 123 - 17
AutoDo/FormAutoDo.Designer.cs

@@ -28,26 +28,38 @@
         /// </summary>
         /// </summary>
         private void InitializeComponent()
         private void InitializeComponent()
         {
         {
+            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea6 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+            System.Windows.Forms.DataVisualization.Charting.Legend legend6 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+            System.Windows.Forms.DataVisualization.Charting.Series series6 = new System.Windows.Forms.DataVisualization.Charting.Series();
             this.button1 = new System.Windows.Forms.Button();
             this.button1 = new System.Windows.Forms.Button();
             this.button2 = new System.Windows.Forms.Button();
             this.button2 = new System.Windows.Forms.Button();
             this.tBImgPath = new System.Windows.Forms.TextBox();
             this.tBImgPath = new System.Windows.Forms.TextBox();
-            this.pictureBox1 = new System.Windows.Forms.PictureBox();
-            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+            this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
+            this.button3 = new System.Windows.Forms.Button();
+            this.dataGridView1 = new System.Windows.Forms.DataGridView();
+            this.wd = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.评价函数值 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.label1 = new System.Windows.Forms.Label();
+            this.button4 = new System.Windows.Forms.Button();
+            this.label2 = new System.Windows.Forms.Label();
+            this.button5 = new System.Windows.Forms.Button();
+            ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
             this.SuspendLayout();
             this.SuspendLayout();
             // 
             // 
             // button1
             // button1
             // 
             // 
             this.button1.Location = new System.Drawing.Point(43, 24);
             this.button1.Location = new System.Drawing.Point(43, 24);
             this.button1.Name = "button1";
             this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(108, 34);
+            this.button1.Size = new System.Drawing.Size(69, 34);
             this.button1.TabIndex = 0;
             this.button1.TabIndex = 0;
-            this.button1.Text = "自动对焦";
+            this.button1.Text = "LoG";
             this.button1.UseVisualStyleBackColor = true;
             this.button1.UseVisualStyleBackColor = true;
             this.button1.Click += new System.EventHandler(this.button1_Click);
             this.button1.Click += new System.EventHandler(this.button1_Click);
             // 
             // 
             // button2
             // button2
             // 
             // 
-            this.button2.Location = new System.Drawing.Point(238, 24);
+            this.button2.Location = new System.Drawing.Point(309, 24);
             this.button2.Name = "button2";
             this.button2.Name = "button2";
             this.button2.Size = new System.Drawing.Size(141, 34);
             this.button2.Size = new System.Drawing.Size(141, 34);
             this.button2.TabIndex = 1;
             this.button2.TabIndex = 1;
@@ -57,33 +69,119 @@
             // 
             // 
             // tBImgPath
             // tBImgPath
             // 
             // 
-            this.tBImgPath.Location = new System.Drawing.Point(385, 30);
+            this.tBImgPath.Location = new System.Drawing.Point(472, 30);
             this.tBImgPath.Name = "tBImgPath";
             this.tBImgPath.Name = "tBImgPath";
             this.tBImgPath.ReadOnly = true;
             this.tBImgPath.ReadOnly = true;
             this.tBImgPath.Size = new System.Drawing.Size(479, 28);
             this.tBImgPath.Size = new System.Drawing.Size(479, 28);
             this.tBImgPath.TabIndex = 2;
             this.tBImgPath.TabIndex = 2;
             // 
             // 
-            // pictureBox1
+            // chart1
             // 
             // 
-            this.pictureBox1.Location = new System.Drawing.Point(43, 82);
-            this.pictureBox1.Name = "pictureBox1";
-            this.pictureBox1.Size = new System.Drawing.Size(535, 493);
-            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
-            this.pictureBox1.TabIndex = 3;
-            this.pictureBox1.TabStop = false;
+            chartArea6.Name = "ChartArea1";
+            this.chart1.ChartAreas.Add(chartArea6);
+            legend6.Name = "Legend1";
+            this.chart1.Legends.Add(legend6);
+            this.chart1.Location = new System.Drawing.Point(43, 88);
+            this.chart1.Name = "chart1";
+            series6.ChartArea = "ChartArea1";
+            series6.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline;
+            series6.Legend = "Legend1";
+            series6.Name = "Series1";
+            this.chart1.Series.Add(series6);
+            this.chart1.Size = new System.Drawing.Size(743, 467);
+            this.chart1.TabIndex = 4;
+            this.chart1.Text = "chart1";
+            // 
+            // button3
+            // 
+            this.button3.Location = new System.Drawing.Point(137, 24);
+            this.button3.Name = "button3";
+            this.button3.Size = new System.Drawing.Size(69, 34);
+            this.button3.TabIndex = 5;
+            this.button3.Text = "梯度";
+            this.button3.UseVisualStyleBackColor = true;
+            this.button3.Click += new System.EventHandler(this.button3_Click);
+            // 
+            // dataGridView1
+            // 
+            this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+            this.wd,
+            this.评价函数值});
+            this.dataGridView1.Location = new System.Drawing.Point(810, 88);
+            this.dataGridView1.Name = "dataGridView1";
+            this.dataGridView1.RowTemplate.Height = 30;
+            this.dataGridView1.Size = new System.Drawing.Size(345, 467);
+            this.dataGridView1.TabIndex = 6;
+            this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
+            // 
+            // wd
+            // 
+            this.wd.HeaderText = "wd";
+            this.wd.Name = "wd";
+            // 
+            // 评价函数值
+            // 
+            this.评价函数值.HeaderText = "评价函数值";
+            this.评价函数值.Name = "评价函数值";
+            this.评价函数值.Width = 200;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(993, 33);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(62, 18);
+            this.label1.TabIndex = 8;
+            this.label1.Text = "焦距:";
+            // 
+            // button4
+            // 
+            this.button4.Location = new System.Drawing.Point(43, 581);
+            this.button4.Name = "button4";
+            this.button4.Size = new System.Drawing.Size(186, 39);
+            this.button4.TabIndex = 9;
+            this.button4.Text = "多种评价函数比较";
+            this.button4.UseVisualStyleBackColor = true;
+            this.button4.Click += new System.EventHandler(this.button4_Click);
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(265, 591);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(0, 18);
+            this.label2.TabIndex = 10;
+            // 
+            // button5
+            // 
+            this.button5.Location = new System.Drawing.Point(223, 24);
+            this.button5.Name = "button5";
+            this.button5.Size = new System.Drawing.Size(69, 34);
+            this.button5.TabIndex = 11;
+            this.button5.Text = "滤波";
+            this.button5.UseVisualStyleBackColor = true;
+            this.button5.Click += new System.EventHandler(this.button5_Click);
             // 
             // 
             // FormAutoDo
             // FormAutoDo
             // 
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1185, 605);
-            this.Controls.Add(this.pictureBox1);
+            this.ClientSize = new System.Drawing.Size(1198, 735);
+            this.Controls.Add(this.button5);
+            this.Controls.Add(this.label2);
+            this.Controls.Add(this.button4);
+            this.Controls.Add(this.label1);
+            this.Controls.Add(this.dataGridView1);
+            this.Controls.Add(this.button3);
+            this.Controls.Add(this.chart1);
             this.Controls.Add(this.tBImgPath);
             this.Controls.Add(this.tBImgPath);
             this.Controls.Add(this.button2);
             this.Controls.Add(this.button2);
             this.Controls.Add(this.button1);
             this.Controls.Add(this.button1);
             this.Name = "FormAutoDo";
             this.Name = "FormAutoDo";
             this.Text = "Form1";
             this.Text = "Form1";
-            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
             this.ResumeLayout(false);
             this.ResumeLayout(false);
             this.PerformLayout();
             this.PerformLayout();
 
 
@@ -94,7 +192,15 @@
         private System.Windows.Forms.Button button1;
         private System.Windows.Forms.Button button1;
         private System.Windows.Forms.Button button2;
         private System.Windows.Forms.Button button2;
         private System.Windows.Forms.TextBox tBImgPath;
         private System.Windows.Forms.TextBox tBImgPath;
-        private System.Windows.Forms.PictureBox pictureBox1;
+        private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
+        private System.Windows.Forms.Button button3;
+        private System.Windows.Forms.DataGridView dataGridView1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn wd;
+        private System.Windows.Forms.DataGridViewTextBoxColumn 评价函数值;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Button button4;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.Button button5;
     }
     }
 }
 }
 
 

+ 265 - 21
AutoDo/FormAutoDo.cs

@@ -12,8 +12,7 @@ using System.Threading.Tasks;
 using System.Windows.Forms;
 using System.Windows.Forms;
 using System.IO;
 using System.IO;
 using OpenCvSharp;
 using OpenCvSharp;
-
-using SmartSEMControl;
+using System.Windows.Forms.DataVisualization.Charting;
 
 
 
 
 namespace AutoDo
 namespace AutoDo
@@ -40,13 +39,35 @@ namespace AutoDo
         {
         {
             //第一种方法
             //第一种方法
             var files = Directory.GetFiles(m_strImgPath, "*.tif");
             var files = Directory.GetFiles(m_strImgPath, "*.tif");
+            float[] values = new float[files.Length];
+            
+            this.dataGridView1.Rows.Clear();
+            Series series = chart1.Series[0];
+            series.Points.Clear();
+
+            int x = 0;
+
+            double smax = LoGMean(files[0]);
+            int wdmax = int.Parse(files[0].Substring(files[0].Length - 8, 4));
 
 
-            int i = 0;
             foreach (var file in files)
             foreach (var file in files)
             {
             {
-                LoGEdge(file);
                
                
+                int wd = int.Parse(file.Substring(file.Length - 8, 4));
+                double svalue = LoGMean(file);
+
+                if (smax < svalue)
+                {
+                    smax = svalue;
+                    wdmax = wd;
+                }
+
+                ShowData(wd, svalue);
+
+                x++;
             }
             }
+
+            this.label1.Text = "焦距:" + wdmax.ToString();
         }
         }
 
 
         //选择图像文件夹
         //选择图像文件夹
@@ -69,37 +90,260 @@ namespace AutoDo
         }
         }
 
 
         //LoG算子计算
         //LoG算子计算
-        private bool LoGEdge(string a_strImgPath)
+        private double LoGMean(string a_strImgPath)
         {
         {
             //读入Img文件
             //读入Img文件
             if (!File.Exists(a_strImgPath))
             if (!File.Exists(a_strImgPath))
             {
             {
-                return false;
+                return 0;
             }
             }
 
 
-            Mat src, src_gray;
+            Mat src, gray_src;
             int kernel_size = 3;
             int kernel_size = 3;
 
 
             src = Cv2.ImRead(a_strImgPath);
             src = Cv2.ImRead(a_strImgPath);
-            src_gray = new Mat();
+            gray_src = new Mat();
+           
+            src.CvtColor(ColorConversionCodes.BGR2GRAY);  
+
+            Mat kernel = Cv2.GetStructuringElement(MorphShapes.Cross, new OpenCvSharp.Size(10, 10));
+            Cv2.MorphologyEx(src, src, MorphTypes.Close, kernel);
 
 
-            //高斯滤波,噪声消除
             Cv2.GaussianBlur(src, src, new OpenCvSharp.Size(3, 3), 0, 0);
             Cv2.GaussianBlur(src, src, new OpenCvSharp.Size(3, 3), 0, 0);
-            //转化为灰度图像
-            Cv2.CvtColor(src, src_gray, ColorConversionCodes.BayerBG2GRAY);
+            Cv2.Laplacian(src, src, MatType.CV_8UC3, kernel_size);
+            Cv2.ConvertScaleAbs(src, src);
 
 
-            Mat dst, abs_dst;
-            dst = new Mat();
-            abs_dst = new Mat();
+            //图像的平均灰度
+
+            double meanValue = 0.0;
+            meanValue = Cv2.Mean(src)[0];
+            return meanValue;
+        }
 
 
-            //使用Laplace函数
-            Cv2.Laplacian(src_gray, dst, MatType.CV_16S, kernel_size);
-            //计算绝对值,并将结果转为8位
-            Cv2.ConvertScaleAbs(dst, abs_dst);            
+        //梯度计算
+        private double Tenengrad(string a_strImgPath)
+        {
+            //读入Img文件
+            if (!File.Exists(a_strImgPath))
+            {
+                return 0;
+            }
+
+            Mat src;
+            src = Cv2.ImRead(a_strImgPath);
+          
+            src.CvtColor(ColorConversionCodes.BGR2GRAY);
+
+            Mat kernel = Cv2.GetStructuringElement(MorphShapes.Cross, new OpenCvSharp.Size(10, 10));
+            Cv2.MorphologyEx(src, src, MorphTypes.Close, kernel);
+
+            Cv2.GaussianBlur(src, src, new OpenCvSharp.Size(3, 3), 0, 0);
+            Cv2.Sobel(src, src, MatType.CV_8UC1, 1, 1);
+            //图像的平均灰度
+            double meanValue = 0.0;
+            meanValue = Cv2.Mean(src)[0];
+            return meanValue;
+        }
+
+        //梯度计算
+        private double TTgrad(string a_strImgPath)
+        {
+            //读入Img文件
+            if (!File.Exists(a_strImgPath))
+            {
+                return 0;
+            }
+
+            Mat src;
+            src = Cv2.ImRead(a_strImgPath);
+
+            src.CvtColor(ColorConversionCodes.BGR2GRAY);
+
+            Mat kernel = Cv2.GetStructuringElement(MorphShapes.Cross, new OpenCvSharp.Size(10, 10));
+            Cv2.MorphologyEx(src, src, MorphTypes.Close, kernel);
+
+            Mat scalex = new Mat();
+            Mat scaley = new Mat();
+
+            Cv2.Scharr(src, src, src.Depth(),1, 0);
+            Cv2.ConvertScaleAbs(src, scalex);
+
+            Cv2.Scharr(src, src, src.Depth(), 0, 1);
+            Cv2.ConvertScaleAbs(src, scaley);
+
+            Cv2.AddWeighted(scalex, 0.5, scaley, 0.5, 0, src);
+
+            //图像的平均灰度
+            double meanValue = 0.0;
+            meanValue = Cv2.Mean(src)[0];
+            return meanValue;
+        }
+
+        private void button3_Click(object sender, EventArgs e)
+        {
+            //第二种方法
+            var files = Directory.GetFiles(m_strImgPath, "*.tif");
+            float[] values = new float[files.Length];
+
+            this.dataGridView1.Rows.Clear();
+            Series series = chart1.Series[0];
+            series.Points.Clear();
+
+
+            double smax = Tenengrad(files[0]);
+            int wdmax = int.Parse(files[0].Substring(files[0].Length - 8, 4));
+
+
+            int x = 0;
+            foreach (var file in files)
+            {
+                
+                int wd = int.Parse(file.Substring(file.Length - 8, 4));
+                double svalue = Tenengrad(file);
+
+
+                if (smax < svalue)
+                {
+                    smax = svalue;
+                    wdmax = wd;
+                }
+
+                ShowData(wd, svalue);
+                x++;
+            }
+
+            this.label1.Text = "焦距:" + wdmax.ToString();
+        }
+
+        //显示数据
+        private void ShowData(int wd, double svalue)
+        {
+            //绘制评价函数曲线s
+            Series series = chart1.Series[0];            
+            series.Points.AddXY(wd, svalue);
+
+            //显示评价函数数值
+            
+            int index = this.dataGridView1.Rows.Add();
+            this.dataGridView1.Rows[index].Cells[0].Value = wd;
+            this.dataGridView1.Rows[index].Cells[1].Value = svalue;
+        }
+
+        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
+        {
+
+        }
+
+        private void button4_Click(object sender, EventArgs e)
+        {
+            var files = Directory.GetFiles(m_strImgPath, "*.tif");
+            float[] values = new float[files.Length];
+
+ 
+            double smax1 = LoGMean(files[0]);
+            int wdmax1 = int.Parse(files[0].Substring(files[0].Length - 8, 4));
+
+            double smax2 = Tenengrad(files[0]);
+            int wdmax2 = int.Parse(files[0].Substring(files[0].Length - 8, 4));
+
+            double smax3 = TTgrad(files[0]);
+            int wdmax3 = int.Parse(files[0].Substring(files[0].Length - 8, 4));
+
+
+
+            int x = 0;
+            foreach (var file in files)
+            {
+
+                int wd = int.Parse(file.Substring(file.Length - 8, 4));
+                double svalue1 = LoGMean(file);
+                double svalue2 = Tenengrad(file);
+                double svalue3 = TTgrad(file);
+
+
+                if (smax1 < svalue1)
+                {
+                    smax1 = svalue1;
+                    wdmax1= wd;
+                }
+
+                if (smax2 < svalue2)
+                {
+                    smax2 = svalue2;
+                    wdmax2 = wd;
+                }
+
+                if (smax3 < svalue3)
+                {
+                    smax3 = svalue3;
+                    wdmax3 = wd;
+                }
+
+                x++;
+            }
+
+            this.label2.Text = "";
+            this.label2.Text = "LoG = " + wdmax1.ToString() + ",梯度 = " + wdmax2.ToString() + ",滤波 = " + wdmax3.ToString();
+
+            
+            if (wdmax1 == wdmax2 || wdmax1 == wdmax3)
+            {
+                
+                this.label2.Text += ",焦距 = " + wdmax1.ToString();
+            }
+            else if (wdmax1 == wdmax2 || wdmax2 == wdmax3)
+            {
+                
+                this.label2.Text += ",焦距 = " + wdmax2.ToString();
+            }
+            else if (wdmax3 == wdmax2 || wdmax1 == wdmax3)
+            {
+               
+                this.label2.Text += ",焦距 = " + wdmax3.ToString();
+            }
+            else
+            {
+                this.label2.Text += ",对焦失败。";
+            }
+
+
+
+            
+        }
+
+        private void button5_Click(object sender, EventArgs e)
+        {
+            //第一种方法
+            var files = Directory.GetFiles(m_strImgPath, "*.tif");
+            float[] values = new float[files.Length];
+
+            this.dataGridView1.Rows.Clear();
+            Series series = chart1.Series[0];
+            series.Points.Clear();
+
+            int x = 0;
+
+            double smax = TTgrad(files[0]);
+            int wdmax = int.Parse(files[0].Substring(files[0].Length - 8, 4));
+
+            foreach (var file in files)
+            {
+
+                int wd = int.Parse(file.Substring(file.Length - 8, 4));
+                double svalue = TTgrad(file);
+
+                if (smax < svalue)
+                {
+                    smax = svalue;
+                    wdmax = wd;
+                }
+
+                ShowData(wd, svalue);
+
+                x++;
+            }
 
 
-            //进行LoG运算
-            return true;
+            this.label1.Text = "焦距:" + wdmax.ToString();
         }
         }
-      
     }
     }
 }
 }

+ 12 - 0
AutoDo/FormAutoDo.resx

@@ -117,4 +117,16 @@
   <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="wd.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="评价函数值.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="wd.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
+  <metadata name="评价函数值.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
 </root>
 </root>

+ 3 - 0
HOZProject/App.config

@@ -13,4 +13,7 @@
       <add key="WLZ" value="类型A,类型B,类型C"/>
       <add key="WLZ" value="类型A,类型B,类型C"/>
       <add key="ConfigFilePath" value="E:/ConfigFile"/>
       <add key="ConfigFilePath" value="E:/ConfigFile"/>
     </appSettings>
     </appSettings>
+  <DefaultParam>
+    <add key ="FIB" value ="C:/HOZ/FIB.ELY"/>
+    </DefaultParam>
 </configuration>
 </configuration>

+ 1 - 1
HOZProject/FormHOZMain.cs

@@ -82,7 +82,7 @@ namespace HOZProject
             this.BeginInvoke((Action)delegate
             this.BeginInvoke((Action)delegate
             {
             {
                 //流程编号
                 //流程编号
-                int eCode = e.Step_Code;
+                string eCode = e.Step_Code;
                 //流程开始时间
                 //流程开始时间
                 DateTime eTime = e.Time;
                 DateTime eTime = e.Time;
                 //图片对象
                 //图片对象

+ 307 - 50
ManulDo/MainForm.Designer.cs

@@ -59,10 +59,33 @@
             this.R = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.R = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.T = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.T = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.listmsg = new System.Windows.Forms.ListBox();
             this.listmsg = new System.Windows.Forms.ListBox();
+            this.tbAutoFocus = new System.Windows.Forms.Button();
+            this.groupBox5 = new System.Windows.Forms.GroupBox();
+            this.btImgPath = new System.Windows.Forms.Button();
+            this.tBImgPath = new System.Windows.Forms.TextBox();
+            this.label3 = new System.Windows.Forms.Label();
+            this.label4 = new System.Windows.Forms.Label();
+            this.label5 = new System.Windows.Forms.Label();
+            this.label6 = new System.Windows.Forms.Label();
+            this.label7 = new System.Windows.Forms.Label();
+            this.label8 = new System.Windows.Forms.Label();
+            this.tB = new System.Windows.Forms.TextBox();
+            this.textBox2 = new System.Windows.Forms.TextBox();
+            this.textBox3 = new System.Windows.Forms.TextBox();
+            this.textBox4 = new System.Windows.Forms.TextBox();
+            this.textBox5 = new System.Windows.Forms.TextBox();
+            this.textBox6 = new System.Windows.Forms.TextBox();
+            this.label9 = new System.Windows.Forms.Label();
+            this.label10 = new System.Windows.Forms.Label();
+            this.label11 = new System.Windows.Forms.Label();
+            this.label12 = new System.Windows.Forms.Label();
+            this.label13 = new System.Windows.Forms.Label();
+            this.label14 = new System.Windows.Forms.Label();
             this.groupBox1.SuspendLayout();
             this.groupBox1.SuspendLayout();
             this.groupBox2.SuspendLayout();
             this.groupBox2.SuspendLayout();
             this.groupBox3.SuspendLayout();
             this.groupBox3.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.CutHoleGridView)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.CutHoleGridView)).BeginInit();
+            this.groupBox5.SuspendLayout();
             this.SuspendLayout();
             this.SuspendLayout();
             // 
             // 
             // groupBox1
             // groupBox1
@@ -70,21 +93,21 @@
             this.groupBox1.Controls.Add(this.btnOpenFile);
             this.groupBox1.Controls.Add(this.btnOpenFile);
             this.groupBox1.Controls.Add(this.btnSaveFile);
             this.groupBox1.Controls.Add(this.btnSaveFile);
             this.groupBox1.Controls.Add(this.btnNewFile);
             this.groupBox1.Controls.Add(this.btnNewFile);
-            this.groupBox1.Location = new System.Drawing.Point(11, 10);
+            this.groupBox1.Location = new System.Drawing.Point(12, 12);
             this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox1.Name = "groupBox1";
             this.groupBox1.Name = "groupBox1";
             this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.groupBox1.Size = new System.Drawing.Size(404, 67);
+            this.groupBox1.Size = new System.Drawing.Size(454, 80);
             this.groupBox1.TabIndex = 1;
             this.groupBox1.TabIndex = 1;
             this.groupBox1.TabStop = false;
             this.groupBox1.TabStop = false;
             this.groupBox1.Text = "测量文件操作";
             this.groupBox1.Text = "测量文件操作";
             // 
             // 
             // btnOpenFile
             // btnOpenFile
             // 
             // 
-            this.btnOpenFile.Location = new System.Drawing.Point(209, 23);
+            this.btnOpenFile.Location = new System.Drawing.Point(235, 28);
             this.btnOpenFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnOpenFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnOpenFile.Name = "btnOpenFile";
             this.btnOpenFile.Name = "btnOpenFile";
-            this.btnOpenFile.Size = new System.Drawing.Size(91, 31);
+            this.btnOpenFile.Size = new System.Drawing.Size(102, 37);
             this.btnOpenFile.TabIndex = 2;
             this.btnOpenFile.TabIndex = 2;
             this.btnOpenFile.Text = "打开";
             this.btnOpenFile.Text = "打开";
             this.btnOpenFile.UseVisualStyleBackColor = true;
             this.btnOpenFile.UseVisualStyleBackColor = true;
@@ -92,10 +115,10 @@
             // 
             // 
             // btnSaveFile
             // btnSaveFile
             // 
             // 
-            this.btnSaveFile.Location = new System.Drawing.Point(113, 23);
+            this.btnSaveFile.Location = new System.Drawing.Point(127, 28);
             this.btnSaveFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnSaveFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnSaveFile.Name = "btnSaveFile";
             this.btnSaveFile.Name = "btnSaveFile";
-            this.btnSaveFile.Size = new System.Drawing.Size(91, 31);
+            this.btnSaveFile.Size = new System.Drawing.Size(102, 37);
             this.btnSaveFile.TabIndex = 1;
             this.btnSaveFile.TabIndex = 1;
             this.btnSaveFile.Text = "保存";
             this.btnSaveFile.Text = "保存";
             this.btnSaveFile.UseVisualStyleBackColor = true;
             this.btnSaveFile.UseVisualStyleBackColor = true;
@@ -103,10 +126,10 @@
             // 
             // 
             // btnNewFile
             // btnNewFile
             // 
             // 
-            this.btnNewFile.Location = new System.Drawing.Point(17, 23);
+            this.btnNewFile.Location = new System.Drawing.Point(19, 28);
             this.btnNewFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnNewFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnNewFile.Name = "btnNewFile";
             this.btnNewFile.Name = "btnNewFile";
-            this.btnNewFile.Size = new System.Drawing.Size(91, 31);
+            this.btnNewFile.Size = new System.Drawing.Size(102, 37);
             this.btnNewFile.TabIndex = 0;
             this.btnNewFile.TabIndex = 0;
             this.btnNewFile.Text = "新建";
             this.btnNewFile.Text = "新建";
             this.btnNewFile.UseVisualStyleBackColor = true;
             this.btnNewFile.UseVisualStyleBackColor = true;
@@ -121,21 +144,21 @@
             this.groupBox2.Controls.Add(this.button4);
             this.groupBox2.Controls.Add(this.button4);
             this.groupBox2.Controls.Add(this.button3);
             this.groupBox2.Controls.Add(this.button3);
             this.groupBox2.Controls.Add(this.btnLoadCutHoles);
             this.groupBox2.Controls.Add(this.btnLoadCutHoles);
-            this.groupBox2.Location = new System.Drawing.Point(11, 82);
+            this.groupBox2.Location = new System.Drawing.Point(12, 98);
             this.groupBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox2.Name = "groupBox2";
             this.groupBox2.Name = "groupBox2";
             this.groupBox2.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox2.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.groupBox2.Size = new System.Drawing.Size(404, 108);
+            this.groupBox2.Size = new System.Drawing.Size(454, 130);
             this.groupBox2.TabIndex = 2;
             this.groupBox2.TabIndex = 2;
             this.groupBox2.TabStop = false;
             this.groupBox2.TabStop = false;
             this.groupBox2.Text = "测量流程";
             this.groupBox2.Text = "测量流程";
             // 
             // 
             // button1
             // button1
             // 
             // 
-            this.button1.Location = new System.Drawing.Point(305, 67);
+            this.button1.Location = new System.Drawing.Point(343, 80);
             this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button1.Name = "button1";
             this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(91, 31);
+            this.button1.Size = new System.Drawing.Size(102, 37);
             this.button1.TabIndex = 6;
             this.button1.TabIndex = 6;
             this.button1.Text = "截面";
             this.button1.Text = "截面";
             this.button1.UseVisualStyleBackColor = true;
             this.button1.UseVisualStyleBackColor = true;
@@ -143,10 +166,10 @@
             // 
             // 
             // button7
             // button7
             // 
             // 
-            this.button7.Location = new System.Drawing.Point(209, 67);
+            this.button7.Location = new System.Drawing.Point(235, 80);
             this.button7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button7.Name = "button7";
             this.button7.Name = "button7";
-            this.button7.Size = new System.Drawing.Size(91, 31);
+            this.button7.Size = new System.Drawing.Size(102, 37);
             this.button7.TabIndex = 5;
             this.button7.TabIndex = 5;
             this.button7.Text = "分析位置";
             this.button7.Text = "分析位置";
             this.button7.UseVisualStyleBackColor = true;
             this.button7.UseVisualStyleBackColor = true;
@@ -154,10 +177,10 @@
             // 
             // 
             // button6
             // button6
             // 
             // 
-            this.button6.Location = new System.Drawing.Point(113, 67);
+            this.button6.Location = new System.Drawing.Point(127, 80);
             this.button6.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button6.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button6.Name = "button6";
             this.button6.Name = "button6";
-            this.button6.Size = new System.Drawing.Size(91, 31);
+            this.button6.Size = new System.Drawing.Size(102, 37);
             this.button6.TabIndex = 4;
             this.button6.TabIndex = 4;
             this.button6.Text = "切割";
             this.button6.Text = "切割";
             this.button6.UseVisualStyleBackColor = true;
             this.button6.UseVisualStyleBackColor = true;
@@ -165,10 +188,10 @@
             // 
             // 
             // button5
             // button5
             // 
             // 
-            this.button5.Location = new System.Drawing.Point(17, 67);
+            this.button5.Location = new System.Drawing.Point(19, 80);
             this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button5.Name = "button5";
             this.button5.Name = "button5";
-            this.button5.Size = new System.Drawing.Size(91, 31);
+            this.button5.Size = new System.Drawing.Size(102, 37);
             this.button5.TabIndex = 3;
             this.button5.TabIndex = 3;
             this.button5.Text = "定位";
             this.button5.Text = "定位";
             this.button5.UseVisualStyleBackColor = true;
             this.button5.UseVisualStyleBackColor = true;
@@ -176,10 +199,10 @@
             // 
             // 
             // button4
             // button4
             // 
             // 
-            this.button4.Location = new System.Drawing.Point(209, 32);
+            this.button4.Location = new System.Drawing.Point(235, 38);
             this.button4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button4.Name = "button4";
             this.button4.Name = "button4";
-            this.button4.Size = new System.Drawing.Size(91, 31);
+            this.button4.Size = new System.Drawing.Size(102, 37);
             this.button4.TabIndex = 2;
             this.button4.TabIndex = 2;
             this.button4.Text = "停止";
             this.button4.Text = "停止";
             this.button4.UseVisualStyleBackColor = true;
             this.button4.UseVisualStyleBackColor = true;
@@ -187,10 +210,10 @@
             // 
             // 
             // button3
             // button3
             // 
             // 
-            this.button3.Location = new System.Drawing.Point(113, 32);
+            this.button3.Location = new System.Drawing.Point(127, 38);
             this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button3.Name = "button3";
             this.button3.Name = "button3";
-            this.button3.Size = new System.Drawing.Size(91, 31);
+            this.button3.Size = new System.Drawing.Size(102, 37);
             this.button3.TabIndex = 1;
             this.button3.TabIndex = 1;
             this.button3.Text = "启动";
             this.button3.Text = "启动";
             this.button3.UseVisualStyleBackColor = true;
             this.button3.UseVisualStyleBackColor = true;
@@ -198,10 +221,10 @@
             // 
             // 
             // btnLoadCutHoles
             // btnLoadCutHoles
             // 
             // 
-            this.btnLoadCutHoles.Location = new System.Drawing.Point(17, 32);
+            this.btnLoadCutHoles.Location = new System.Drawing.Point(19, 38);
             this.btnLoadCutHoles.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnLoadCutHoles.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnLoadCutHoles.Name = "btnLoadCutHoles";
             this.btnLoadCutHoles.Name = "btnLoadCutHoles";
-            this.btnLoadCutHoles.Size = new System.Drawing.Size(91, 31);
+            this.btnLoadCutHoles.Size = new System.Drawing.Size(102, 37);
             this.btnLoadCutHoles.TabIndex = 0;
             this.btnLoadCutHoles.TabIndex = 0;
             this.btnLoadCutHoles.Text = "导入切孔";
             this.btnLoadCutHoles.Text = "导入切孔";
             this.btnLoadCutHoles.UseVisualStyleBackColor = true;
             this.btnLoadCutHoles.UseVisualStyleBackColor = true;
@@ -217,21 +240,21 @@
             this.groupBox3.Controls.Add(this.tBSampleName);
             this.groupBox3.Controls.Add(this.tBSampleName);
             this.groupBox3.Controls.Add(this.cBIsManul);
             this.groupBox3.Controls.Add(this.cBIsManul);
             this.groupBox3.Controls.Add(this.cBIsPT);
             this.groupBox3.Controls.Add(this.cBIsPT);
-            this.groupBox3.Location = new System.Drawing.Point(12, 196);
+            this.groupBox3.Location = new System.Drawing.Point(14, 235);
             this.groupBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox3.Name = "groupBox3";
             this.groupBox3.Name = "groupBox3";
             this.groupBox3.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox3.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.groupBox3.Size = new System.Drawing.Size(404, 91);
+            this.groupBox3.Size = new System.Drawing.Size(454, 109);
             this.groupBox3.TabIndex = 3;
             this.groupBox3.TabIndex = 3;
             this.groupBox3.TabStop = false;
             this.groupBox3.TabStop = false;
             this.groupBox3.Text = "测量参数";
             this.groupBox3.Text = "测量参数";
             // 
             // 
             // btParamOK
             // btParamOK
             // 
             // 
-            this.btParamOK.Location = new System.Drawing.Point(304, 56);
+            this.btParamOK.Location = new System.Drawing.Point(342, 67);
             this.btParamOK.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btParamOK.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btParamOK.Name = "btParamOK";
             this.btParamOK.Name = "btParamOK";
-            this.btParamOK.Size = new System.Drawing.Size(91, 31);
+            this.btParamOK.Size = new System.Drawing.Size(102, 37);
             this.btParamOK.TabIndex = 7;
             this.btParamOK.TabIndex = 7;
             this.btParamOK.Text = "确定";
             this.btParamOK.Text = "确定";
             this.btParamOK.UseVisualStyleBackColor = true;
             this.btParamOK.UseVisualStyleBackColor = true;
@@ -239,10 +262,10 @@
             // 
             // 
             // btFIB
             // btFIB
             // 
             // 
-            this.btFIB.Location = new System.Drawing.Point(164, 50);
+            this.btFIB.Location = new System.Drawing.Point(184, 60);
             this.btFIB.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btFIB.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btFIB.Name = "btFIB";
             this.btFIB.Name = "btFIB";
-            this.btFIB.Size = new System.Drawing.Size(38, 22);
+            this.btFIB.Size = new System.Drawing.Size(43, 26);
             this.btFIB.TabIndex = 6;
             this.btFIB.TabIndex = 6;
             this.btFIB.Text = "...";
             this.btFIB.Text = "...";
             this.btFIB.UseVisualStyleBackColor = true;
             this.btFIB.UseVisualStyleBackColor = true;
@@ -250,46 +273,46 @@
             // 
             // 
             // tBFIBTemp
             // tBFIBTemp
             // 
             // 
-            this.tBFIBTemp.Location = new System.Drawing.Point(76, 49);
+            this.tBFIBTemp.Location = new System.Drawing.Point(86, 59);
             this.tBFIBTemp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.tBFIBTemp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.tBFIBTemp.Name = "tBFIBTemp";
             this.tBFIBTemp.Name = "tBFIBTemp";
             this.tBFIBTemp.ReadOnly = true;
             this.tBFIBTemp.ReadOnly = true;
-            this.tBFIBTemp.Size = new System.Drawing.Size(89, 25);
+            this.tBFIBTemp.Size = new System.Drawing.Size(100, 28);
             this.tBFIBTemp.TabIndex = 5;
             this.tBFIBTemp.TabIndex = 5;
             // 
             // 
             // label2
             // label2
             // 
             // 
             this.label2.AutoSize = true;
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(15, 57);
+            this.label2.Location = new System.Drawing.Point(17, 68);
             this.label2.Name = "label2";
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(61, 15);
+            this.label2.Size = new System.Drawing.Size(71, 18);
             this.label2.TabIndex = 4;
             this.label2.TabIndex = 4;
             this.label2.Text = "FIB模板";
             this.label2.Text = "FIB模板";
             // 
             // 
             // label1
             // label1
             // 
             // 
             this.label1.AutoSize = true;
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(183, 26);
+            this.label1.Location = new System.Drawing.Point(206, 31);
             this.label1.Name = "label1";
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(67, 15);
+            this.label1.Size = new System.Drawing.Size(80, 18);
             this.label1.TabIndex = 3;
             this.label1.TabIndex = 3;
             this.label1.Text = "样品名称";
             this.label1.Text = "样品名称";
             // 
             // 
             // tBSampleName
             // tBSampleName
             // 
             // 
-            this.tBSampleName.Location = new System.Drawing.Point(256, 23);
+            this.tBSampleName.Location = new System.Drawing.Point(288, 28);
             this.tBSampleName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.tBSampleName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.tBSampleName.Name = "tBSampleName";
             this.tBSampleName.Name = "tBSampleName";
-            this.tBSampleName.Size = new System.Drawing.Size(89, 25);
+            this.tBSampleName.Size = new System.Drawing.Size(100, 28);
             this.tBSampleName.TabIndex = 2;
             this.tBSampleName.TabIndex = 2;
             // 
             // 
             // cBIsManul
             // cBIsManul
             // 
             // 
             this.cBIsManul.AutoSize = true;
             this.cBIsManul.AutoSize = true;
-            this.cBIsManul.Location = new System.Drawing.Point(84, 23);
+            this.cBIsManul.Location = new System.Drawing.Point(94, 28);
             this.cBIsManul.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.cBIsManul.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.cBIsManul.Name = "cBIsManul";
             this.cBIsManul.Name = "cBIsManul";
-            this.cBIsManul.Size = new System.Drawing.Size(89, 19);
+            this.cBIsManul.Size = new System.Drawing.Size(106, 22);
             this.cBIsManul.TabIndex = 1;
             this.cBIsManul.TabIndex = 1;
             this.cBIsManul.Text = "手动对焦";
             this.cBIsManul.Text = "手动对焦";
             this.cBIsManul.UseVisualStyleBackColor = true;
             this.cBIsManul.UseVisualStyleBackColor = true;
@@ -297,10 +320,10 @@
             // cBIsPT
             // cBIsPT
             // 
             // 
             this.cBIsPT.AutoSize = true;
             this.cBIsPT.AutoSize = true;
-            this.cBIsPT.Location = new System.Drawing.Point(16, 23);
+            this.cBIsPT.Location = new System.Drawing.Point(18, 28);
             this.cBIsPT.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.cBIsPT.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.cBIsPT.Name = "cBIsPT";
             this.cBIsPT.Name = "cBIsPT";
-            this.cBIsPT.Size = new System.Drawing.Size(60, 19);
+            this.cBIsPT.Size = new System.Drawing.Size(70, 22);
             this.cBIsPT.TabIndex = 0;
             this.cBIsPT.TabIndex = 0;
             this.cBIsPT.Text = "有PT";
             this.cBIsPT.Text = "有PT";
             this.cBIsPT.UseVisualStyleBackColor = true;
             this.cBIsPT.UseVisualStyleBackColor = true;
@@ -319,12 +342,12 @@
             this.M,
             this.M,
             this.R,
             this.R,
             this.T});
             this.T});
-            this.CutHoleGridView.Location = new System.Drawing.Point(11, 292);
+            this.CutHoleGridView.Location = new System.Drawing.Point(12, 350);
             this.CutHoleGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.CutHoleGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.CutHoleGridView.Name = "CutHoleGridView";
             this.CutHoleGridView.Name = "CutHoleGridView";
             this.CutHoleGridView.ReadOnly = true;
             this.CutHoleGridView.ReadOnly = true;
             this.CutHoleGridView.RowTemplate.Height = 30;
             this.CutHoleGridView.RowTemplate.Height = 30;
-            this.CutHoleGridView.Size = new System.Drawing.Size(690, 219);
+            this.CutHoleGridView.Size = new System.Drawing.Size(776, 263);
             this.CutHoleGridView.TabIndex = 16;
             this.CutHoleGridView.TabIndex = 16;
             // 
             // 
             // Name
             // Name
@@ -365,30 +388,242 @@
             // listmsg
             // listmsg
             // 
             // 
             this.listmsg.FormattingEnabled = true;
             this.listmsg.FormattingEnabled = true;
-            this.listmsg.ItemHeight = 15;
-            this.listmsg.Location = new System.Drawing.Point(713, 10);
+            this.listmsg.ItemHeight = 18;
+            this.listmsg.Location = new System.Drawing.Point(802, 12);
+            this.listmsg.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.listmsg.Name = "listmsg";
             this.listmsg.Name = "listmsg";
-            this.listmsg.Size = new System.Drawing.Size(697, 604);
+            this.listmsg.Size = new System.Drawing.Size(784, 832);
             this.listmsg.TabIndex = 17;
             this.listmsg.TabIndex = 17;
             // 
             // 
+            // tbAutoFocus
+            // 
+            this.tbAutoFocus.Location = new System.Drawing.Point(630, 158);
+            this.tbAutoFocus.Name = "tbAutoFocus";
+            this.tbAutoFocus.Size = new System.Drawing.Size(114, 32);
+            this.tbAutoFocus.TabIndex = 18;
+            this.tbAutoFocus.Text = "对焦";
+            this.tbAutoFocus.UseVisualStyleBackColor = true;
+            // 
+            // groupBox5
+            // 
+            this.groupBox5.Controls.Add(this.label14);
+            this.groupBox5.Controls.Add(this.label13);
+            this.groupBox5.Controls.Add(this.label12);
+            this.groupBox5.Controls.Add(this.label11);
+            this.groupBox5.Controls.Add(this.label10);
+            this.groupBox5.Controls.Add(this.label9);
+            this.groupBox5.Controls.Add(this.textBox6);
+            this.groupBox5.Controls.Add(this.textBox5);
+            this.groupBox5.Controls.Add(this.textBox4);
+            this.groupBox5.Controls.Add(this.textBox3);
+            this.groupBox5.Controls.Add(this.textBox2);
+            this.groupBox5.Controls.Add(this.tB);
+            this.groupBox5.Controls.Add(this.label8);
+            this.groupBox5.Controls.Add(this.label7);
+            this.groupBox5.Controls.Add(this.label6);
+            this.groupBox5.Controls.Add(this.label5);
+            this.groupBox5.Controls.Add(this.label4);
+            this.groupBox5.Controls.Add(this.label3);
+            this.groupBox5.Controls.Add(this.tBImgPath);
+            this.groupBox5.Controls.Add(this.btImgPath);
+            this.groupBox5.Controls.Add(this.tbAutoFocus);
+            this.groupBox5.Location = new System.Drawing.Point(17, 636);
+            this.groupBox5.Name = "groupBox5";
+            this.groupBox5.Size = new System.Drawing.Size(771, 207);
+            this.groupBox5.TabIndex = 19;
+            this.groupBox5.TabStop = false;
+            this.groupBox5.Text = "自动对焦";
+            // 
+            // btImgPath
+            // 
+            this.btImgPath.Location = new System.Drawing.Point(17, 25);
+            this.btImgPath.Name = "btImgPath";
+            this.btImgPath.Size = new System.Drawing.Size(266, 35);
+            this.btImgPath.TabIndex = 20;
+            this.btImgPath.Text = "选择图像存储路径";
+            this.btImgPath.UseVisualStyleBackColor = true;
+            this.btImgPath.Click += new System.EventHandler(this.btImgPath_Click);
+            // 
+            // tBImgPath
+            // 
+            this.tBImgPath.Location = new System.Drawing.Point(302, 27);
+            this.tBImgPath.Name = "tBImgPath";
+            this.tBImgPath.ReadOnly = true;
+            this.tBImgPath.Size = new System.Drawing.Size(450, 28);
+            this.tBImgPath.TabIndex = 21;
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(33, 83);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(80, 18);
+            this.label3.TabIndex = 8;
+            this.label3.Text = "调节上限";
+            // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.Location = new System.Drawing.Point(299, 83);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(80, 18);
+            this.label4.TabIndex = 22;
+            this.label4.Text = "调节下限";
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Location = new System.Drawing.Point(530, 83);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(80, 18);
+            this.label5.TabIndex = 23;
+            this.label5.Text = "调节步长";
+            // 
+            // label6
+            // 
+            this.label6.AutoSize = true;
+            this.label6.Location = new System.Drawing.Point(36, 119);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(80, 18);
+            this.label6.TabIndex = 24;
+            this.label6.Text = "精调范围";
+            // 
+            // label7
+            // 
+            this.label7.AutoSize = true;
+            this.label7.Location = new System.Drawing.Point(305, 119);
+            this.label7.Name = "label7";
+            this.label7.Size = new System.Drawing.Size(80, 18);
+            this.label7.TabIndex = 25;
+            this.label7.Text = "精调步长";
+            // 
+            // label8
+            // 
+            this.label8.AutoSize = true;
+            this.label8.Location = new System.Drawing.Point(530, 119);
+            this.label8.Name = "label8";
+            this.label8.Size = new System.Drawing.Size(44, 18);
+            this.label8.TabIndex = 26;
+            this.label8.Text = "焦距";
+            // 
+            // tB
+            // 
+            this.tB.Location = new System.Drawing.Point(119, 78);
+            this.tB.Name = "tB";
+            this.tB.Size = new System.Drawing.Size(96, 28);
+            this.tB.TabIndex = 27;
+            // 
+            // textBox2
+            // 
+            this.textBox2.Location = new System.Drawing.Point(385, 80);
+            this.textBox2.Name = "textBox2";
+            this.textBox2.Size = new System.Drawing.Size(96, 28);
+            this.textBox2.TabIndex = 28;
+            // 
+            // textBox3
+            // 
+            this.textBox3.Location = new System.Drawing.Point(616, 78);
+            this.textBox3.Name = "textBox3";
+            this.textBox3.Size = new System.Drawing.Size(96, 28);
+            this.textBox3.TabIndex = 29;
+            // 
+            // textBox4
+            // 
+            this.textBox4.Location = new System.Drawing.Point(120, 116);
+            this.textBox4.Name = "textBox4";
+            this.textBox4.Size = new System.Drawing.Size(96, 28);
+            this.textBox4.TabIndex = 30;
+            // 
+            // textBox5
+            // 
+            this.textBox5.Location = new System.Drawing.Point(385, 119);
+            this.textBox5.Name = "textBox5";
+            this.textBox5.Size = new System.Drawing.Size(96, 28);
+            this.textBox5.TabIndex = 31;
+            // 
+            // textBox6
+            // 
+            this.textBox6.Location = new System.Drawing.Point(616, 118);
+            this.textBox6.Name = "textBox6";
+            this.textBox6.ReadOnly = true;
+            this.textBox6.Size = new System.Drawing.Size(96, 28);
+            this.textBox6.TabIndex = 32;
+            // 
+            // label9
+            // 
+            this.label9.AutoSize = true;
+            this.label9.Location = new System.Drawing.Point(218, 84);
+            this.label9.Name = "label9";
+            this.label9.Size = new System.Drawing.Size(26, 18);
+            this.label9.TabIndex = 33;
+            this.label9.Text = "um";
+            // 
+            // label10
+            // 
+            this.label10.AutoSize = true;
+            this.label10.Location = new System.Drawing.Point(487, 84);
+            this.label10.Name = "label10";
+            this.label10.Size = new System.Drawing.Size(26, 18);
+            this.label10.TabIndex = 34;
+            this.label10.Text = "um";
+            // 
+            // label11
+            // 
+            this.label11.AutoSize = true;
+            this.label11.Location = new System.Drawing.Point(718, 84);
+            this.label11.Name = "label11";
+            this.label11.Size = new System.Drawing.Size(26, 18);
+            this.label11.TabIndex = 35;
+            this.label11.Text = "um";
+            // 
+            // label12
+            // 
+            this.label12.AutoSize = true;
+            this.label12.Location = new System.Drawing.Point(222, 121);
+            this.label12.Name = "label12";
+            this.label12.Size = new System.Drawing.Size(26, 18);
+            this.label12.TabIndex = 36;
+            this.label12.Text = "um";
+            // 
+            // label13
+            // 
+            this.label13.AutoSize = true;
+            this.label13.Location = new System.Drawing.Point(487, 126);
+            this.label13.Name = "label13";
+            this.label13.Size = new System.Drawing.Size(26, 18);
+            this.label13.TabIndex = 37;
+            this.label13.Text = "um";
+            // 
+            // label14
+            // 
+            this.label14.AutoSize = true;
+            this.label14.Location = new System.Drawing.Point(718, 122);
+            this.label14.Name = "label14";
+            this.label14.Size = new System.Drawing.Size(26, 18);
+            this.label14.TabIndex = 38;
+            this.label14.Text = "um";
+            // 
             // MainForm
             // MainForm
             // 
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1422, 628);
+            this.ClientSize = new System.Drawing.Size(1600, 854);
+            this.Controls.Add(this.groupBox5);
             this.Controls.Add(this.listmsg);
             this.Controls.Add(this.listmsg);
             this.Controls.Add(this.CutHoleGridView);
             this.Controls.Add(this.CutHoleGridView);
             this.Controls.Add(this.groupBox3);
             this.Controls.Add(this.groupBox3);
             this.Controls.Add(this.groupBox2);
             this.Controls.Add(this.groupBox2);
             this.Controls.Add(this.groupBox1);
             this.Controls.Add(this.groupBox1);
             this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            //this.Name = "MainForm";
+            this.Name = "MainForm";
             this.Text = "测量流程测试";
             this.Text = "测量流程测试";
             this.groupBox1.ResumeLayout(false);
             this.groupBox1.ResumeLayout(false);
             this.groupBox2.ResumeLayout(false);
             this.groupBox2.ResumeLayout(false);
             this.groupBox3.ResumeLayout(false);
             this.groupBox3.ResumeLayout(false);
             this.groupBox3.PerformLayout();
             this.groupBox3.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.CutHoleGridView)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.CutHoleGridView)).EndInit();
+            this.groupBox5.ResumeLayout(false);
+            this.groupBox5.PerformLayout();
             this.ResumeLayout(false);
             this.ResumeLayout(false);
 
 
         }
         }
@@ -424,6 +659,28 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn R;
         private System.Windows.Forms.DataGridViewTextBoxColumn R;
         private System.Windows.Forms.DataGridViewTextBoxColumn T;
         private System.Windows.Forms.DataGridViewTextBoxColumn T;
         private System.Windows.Forms.ListBox listmsg;
         private System.Windows.Forms.ListBox listmsg;
+        private System.Windows.Forms.Button tbAutoFocus;
+        private System.Windows.Forms.GroupBox groupBox5;
+        private System.Windows.Forms.Button btImgPath;
+        private System.Windows.Forms.TextBox tBImgPath;
+        private System.Windows.Forms.Label label9;
+        private System.Windows.Forms.TextBox textBox6;
+        private System.Windows.Forms.TextBox textBox5;
+        private System.Windows.Forms.TextBox textBox4;
+        private System.Windows.Forms.TextBox textBox3;
+        private System.Windows.Forms.TextBox textBox2;
+        private System.Windows.Forms.TextBox tB;
+        private System.Windows.Forms.Label label8;
+        private System.Windows.Forms.Label label7;
+        private System.Windows.Forms.Label label6;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.Label label14;
+        private System.Windows.Forms.Label label13;
+        private System.Windows.Forms.Label label12;
+        private System.Windows.Forms.Label label11;
+        private System.Windows.Forms.Label label10;
     }
     }
 }
 }
 
 

+ 22 - 1
ManulDo/MainForm.cs

@@ -25,7 +25,10 @@ namespace WindowsFormsApp1
         
         
         /// 测量线程  
         /// 测量线程  
         public Measure m_Ms;
         public Measure m_Ms;
-        
+
+        //图像文件夹
+        public string m_strImgPath;
+
         #endregion
         #endregion
         #region 构造函数
         #region 构造函数
         public MainForm()
         public MainForm()
@@ -265,5 +268,23 @@ namespace WindowsFormsApp1
         {
         {
 
 
         }
         }
+
+        private void btImgPath_Click(object sender, EventArgs e)
+        {
+            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
+            dialog.Description = "选择拍图保存的文件夹";
+            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
+            {
+                if (string.IsNullOrEmpty(dialog.SelectedPath))
+                {
+                    MessageBox.Show("图像文件夹不能为空");
+                    return;
+                }
+
+                m_strImgPath = dialog.SelectedPath;
+                tBImgPath.Text = dialog.SelectedPath;
+
+            }
+        }
     }
     }
 }
 }

+ 1 - 1
MeasureData/ConfigFile.cs

@@ -112,7 +112,7 @@ namespace MeasureData
         //对焦参数
         //对焦参数
 
 
         //能谱参数
         //能谱参数
-
+        //MeasureParam m_
         #endregion
         #endregion
 
 
         public ConfigFile()
         public ConfigFile()

+ 100 - 0
MeasureData/MeasureParam.cs

@@ -58,6 +58,106 @@ namespace MeasureData
             get { return m_fMode; }
             get { return m_fMode; }
             set { m_fMode = value; }
             set { m_fMode = value; }
         }
         }
+
+        //是否仅拍照
+        private Boolean is_Photograph;
+        public Boolean Is_Photograph
+        {
+            get { return this.is_Photograph; }
+            set { this.is_Photograph = value; }
+        }
+
+        //是否PT沉积
+        private Boolean pt_Depostion;
+        public Boolean PT_Depostion
+        {
+            get { return this.pt_Depostion; }
+            set { this.pt_Depostion = value; }
+        }
+
+        //PT使用的ELY文件
+        private String pt_ELYFile;
+        public String PT_ELYFile
+        {
+            get { return this.pt_ELYFile; }
+            set { this.pt_ELYFile = value; }
+        }
+
+        //FIB使用的ELY文件
+        private String fib_ELYFile;
+        public String FIB_ELYFile
+        {
+            get { return this.fib_ELYFile; }
+            set { this.fib_ELYFile = value; }
+        }
+
+        //拉直操作需要的放大位数
+        private double stretch_Magnification;
+        public double Stretch_Magnification
+        {
+            get { return this.stretch_Magnification; }
+            set { this.stretch_Magnification = value; }
+        }
+
+        //定位切割位置的放大倍数
+        private double location_Magnification;
+        public double Location_Magnification
+        {
+            get { return this.location_Magnification; }
+            set { this.location_Magnification = value; }
+        }
+
+        //定位切割位置的工作电压
+        private double location_Voltage;
+        public double Location_Voltage
+        {
+            get { return this.location_Voltage; }
+            set { this.location_Voltage = value; }
+        }
+
+        //拍照的放大倍数
+        private double photograph_Magnification;
+        public double Photograph_Magnification
+        {
+            get { return this.photograph_Magnification; }
+            set { this.photograph_Magnification = value; }
+        }
+
+        //拍照的工作电压
+        private double photograph_Voltage;
+        public double Photograph_Voltage
+        {
+            get { return this.photograph_Voltage; }
+            set { this.photograph_Voltage = value; }
+        }
+
+        //校正角度选择
+        private double correction_Angle;
+        public double Correction_Angle
+        {
+            get { return this.correction_Angle; }
+            set { this.correction_Angle = value; }
+        }
+
+        //样品类型
+        private String sample_Type;
+        public String Sample_Type
+        {
+            get { return this.sample_Type; }
+            set { this.sample_Type = value; }
+        }
+
+        //厂商
+        private String firm;
+        public String Firm
+        {
+            get { return this.firm; }
+            set { this.firm = value; }
+        }
+
+        //对焦参数
+
+        //能谱参数
         #endregion
         #endregion
 
 
         //构造函数
         //构造函数

+ 12 - 3
MeasureThread/Measure.cs

@@ -386,7 +386,7 @@ namespace MeasureThread
             set { this.m_measureFile = value; }
             set { this.m_measureFile = value; }
         }
         }
 
 
-        //测量的切割孔
+        //测量的切割孔,取测量文件里的孔
         private List<MeasureData.CutHole> m_cutHoles;
         private List<MeasureData.CutHole> m_cutHoles;
         public List<MeasureData.CutHole> cutHoles
         public List<MeasureData.CutHole> cutHoles
         {
         {
@@ -429,7 +429,7 @@ namespace MeasureThread
 
 
         private void Init()
         private void Init()
         {
         {
-            MeasParam = new MeasureParam();
+            //MeasParam = new MeasureParam();
             TStatus = new ThreadStatus();
             TStatus = new ThreadStatus();
             cutHoles = new List<MeasureData.CutHole>();
             cutHoles = new List<MeasureData.CutHole>();
         }
         }
@@ -1585,7 +1585,16 @@ namespace MeasureThread
 
 
             return true;
             return true;
         }
         }
-        
 
 
+        //自动对焦
+        public bool AutoFocus(string a_strPath, out int a_wd)
+        {
+            a_wd = 10;
+
+            //1. 拍照
+            //2. 计算评价函数
+            //3. 获取焦距
+            return true;
+        }
     }
     }
 }
 }