فهرست منبع

improve the visualizing work flow of SpecialParticleForm window.

gsp 3 سال پیش
والد
کامیت
9c9e3bb9c8

+ 1 - 1
Bin/x64/Debug/Config/SysData/OTSStage.stg

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<XMLData Modify="true" PathName=".\Config\SysData\OTSStage.stg" WorkingStageId="1">
+<XMLData Modify="true" PathName=".\Config\SysData\OTSStage.stg" WorkingStageId="0">
   <Collection RegName="Stagelist">
     <Member strName="圆形九圆孔50mm">
       <Member RegName="boundary" PolygonPoint="" rectDomian="0,0,50000,0" shape="0" />

+ 47 - 64
OTSCommon/XMLoperate.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Data;
 using System.IO;
 using System.Linq;
+using System.Windows.Forms;
 using System.Xml;
 
 namespace OTSCommon
@@ -66,8 +67,7 @@ namespace OTSCommon
         //必须创建对象才能使用的类
         private bool _alreadyDispose = false;
         private XmlDocument xmlDoc = new XmlDocument();
-        //private XmlNode xmlNode;
-        //private XmlElement xmlElem;
+  
         private string _xmlPath;
 
         #region 构造与释构
@@ -701,88 +701,71 @@ namespace OTSCommon
                 }
             }
 
+           
+
+
             return dsResult;
         }
+       
 
-        /// <summary>
-        /// 特殊颗粒XML修改
-        /// </summary>
-        /// <param name="FilePath">文件地址</param>
-        /// <param name="RegName">节点名称</param>
-        /// <returns>DataSet</returns>
-        public static bool UpdateXMLRegList(string FilePath, string TagName, string RowIndex, string MemberName, string MemberValue)
+      
+        public static bool UpdateSpecialGrayXMLFile(string FilePath, DataGridView dg,bool isToRun)
         {
             XmlDocument xmlDoc = new XmlDocument();
 
             xmlDoc.Load(FilePath);    //加载Xml文件  
 
-            XmlNodeList nodeList = xmlDoc.GetElementsByTagName(TagName);
-
-            for (int i = 0; i < nodeList.Count; i++)
+            xmlDoc.RemoveAll();
+            XmlElement xmlData = xmlDoc.CreateElement("XMLData");
+            xmlDoc.AppendChild(xmlData);
+            if (isToRun)
             {
-                XmlElement ele = (XmlElement)nodeList[i];
-                if (i.ToString() == RowIndex)
-                {
-                    ele.SetAttribute(MemberName, MemberValue);
-                    break;
-                }
+                xmlData.SetAttribute("ToRun", "True");
             }
+            else 
+            {
+                xmlData.SetAttribute("ToRun", "False");
+            }
+            XmlElement membercol = xmlDoc.CreateElement("Collection");
+            membercol.SetAttribute("RegName", "GrayRangeList");
+            xmlData.AppendChild(membercol);
 
-            xmlDoc.Save(FilePath);
-
-            return true;
-        }
-
-        /// <summary>
-        /// 特殊颗粒XML添加
-        /// </summary>
-        /// <param name="FilePath">文件地址</param>
-        /// <param name="RegName">节点名称</param>
-        /// <returns>DataSet</returns>
-        public static bool AddXMLRegList(string FilePath, string RegName, string start, string end, string diameterStart, string diameterEnd, string collectXray)
-        {
-            XmlDocument xmlDoc = new XmlDocument();
+            for (int i = 0; i < dg.Rows.Count; i++)
+            {
+               
+               XmlElement member = xmlDoc.CreateElement("Member");
+                membercol.AppendChild(member);
+                for (int j = 0; j < dg.Columns.Count; j++)
+                {
 
-            xmlDoc.Load(FilePath);    //加载Xml文件  
+                    //设置参数
+                    member.SetAttribute("RegName", dg.Rows[i].Cells["RegName"].Value.ToString());
+                    member.SetAttribute("start", dg.Rows[i].Cells["start"].Value.ToString());
+                    member.SetAttribute("end", dg.Rows[i].Cells["end"].Value.ToString());
+                    member.SetAttribute("diameterStart", dg.Rows[i].Cells["diameterStart"].Value.ToString());
+                    member.SetAttribute("diameterEnd", dg.Rows[i].Cells["diameterEnd"].Value.ToString());
+                    if (dg.Rows[i].Cells["collectXray"].Value==DBNull.Value || dg.Rows[i].Cells["collectXray"].Value.ToString() == "false")
+                    {
+                        member.SetAttribute("collectXray", "false");
+                    }
+                    else 
+                    {
+                        member.SetAttribute("collectXray", "true");
+                    }
+                   
+                  
 
-            XmlElement root = xmlDoc.DocumentElement;
-            //根节点的添加独立子节点  
-            XmlElement systemData = xmlDoc.CreateElement("Member");
-            //设置参数
-            systemData.SetAttribute("RegName", RegName);
-            systemData.SetAttribute("start", start);
-            systemData.SetAttribute("end", end);
-            systemData.SetAttribute("diameterStart", diameterStart);
-            systemData.SetAttribute("diameterEnd", diameterEnd);
-            systemData.SetAttribute("collectXray", collectXray);
-            //添加至父节点
-            root.FirstChild.AppendChild(systemData);
+                }
+            }
+          
 
             xmlDoc.Save(FilePath);
 
             return true;
         }
 
-        /// <summary>
-        /// 特殊颗粒XML删除
-        /// </summary>
-        /// <param name="FilePath">文件地址</param>
-        /// <param name="RegName">节点名称</param>
-        /// <returns>DataSet</returns>
-        public static bool DeleteXMLRegList(string FilePath, string TagName, int RowIndex)
-        {
-            XmlDocument xmlDoc = new XmlDocument();
-
-            xmlDoc.Load(FilePath);    //加载Xml文件  
+       
 
-            XmlNodeList nodeList = xmlDoc.GetElementsByTagName(TagName);
-
-            nodeList.Item(RowIndex).ParentNode.RemoveChild(nodeList[RowIndex]);
-
-            xmlDoc.Save(FilePath);
-
-            return true;
-        }
         #endregion
 
     }

+ 7 - 22
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.cs

@@ -19,6 +19,7 @@ using OTSModelSharp;
 using OTSDataType;
 using OTSModelSharp.ServiceInterface;
 using OTSModelSharp.ServiceCenter;
+using OTSMeasureApp._0_OTSModel.Measure.ParamData;
 
 namespace OTSMeasureApp
 {
@@ -30,8 +31,8 @@ namespace OTSMeasureApp
         /* 接收图像数据 */
         public byte[] Imagedata = new byte[m_iWidth];
 
-        static int m_iWidth = 1024;
-        static int m_iHeight = 704;
+        static int m_iWidth = 0;
+        static int m_iHeight = 0;
 
         OTSImageData m_ImageData = null;
         //获取BSE图时最初的位置
@@ -1945,26 +1946,10 @@ namespace OTSMeasureApp
 
         private void toolStripMenuItem1_Click(object sender, EventArgs e)
         {
-            frmSpecialGrayParticle toolWindow = new frmSpecialGrayParticle(m_MeasureAppForm, this);
-            int grayStart = 0;
-            int grayEnd = 0;
-            if (bBseData != null)
-            {
-                Bitmap bitmap = CImageHandler.ToGrayBitmap(bBseData, m_iWidth, m_iHeight);
-                toolWindow.BseImg = bitmap;
-                toolWindow.SetBBseData(bBseData);
-                //获取颗粒灰度范围
-                grayStart = m_MeasureAppForm.m_ProjParam.GetWorkSample().GetMsrParams().GetImageProcessParam().GetBGGray().GetStart();
-                grayEnd = m_MeasureAppForm.m_ProjParam.GetWorkSample().GetMsrParams().GetImageProcessParam().GetBGGray().GetEnd();
-                //设置可视化中的属性
-                toolWindow.BseGrayMinValue = grayStart;
-                toolWindow.BseGrayMaxValue = grayEnd;
-            }
-            DialogResult dialogResult = toolWindow.ShowDialog();
-            if (dialogResult == DialogResult.Cancel)
-            {
-                return;
-            }
+            SpecialParticleForm specialParticleForm = new SpecialParticleForm(CSpecialGrayRangeParam.GetParamFileFullName(), m_MeasureAppForm,  bBseData, m_iWidth, m_iHeight,this);
+            DialogResult dialogResult = specialParticleForm.ShowDialog();
+
+    
         }
     }
 }

+ 90 - 59
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/SlopFocus.Designer.cs

@@ -64,9 +64,10 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             // cB_enable
             // 
             this.cB_enable.AutoSize = true;
-            this.cB_enable.Location = new System.Drawing.Point(15, 15);
+            this.cB_enable.Location = new System.Drawing.Point(11, 12);
+            this.cB_enable.Margin = new System.Windows.Forms.Padding(2);
             this.cB_enable.Name = "cB_enable";
-            this.cB_enable.Size = new System.Drawing.Size(165, 19);
+            this.cB_enable.Size = new System.Drawing.Size(126, 16);
             this.cB_enable.TabIndex = 0;
             this.cB_enable.Text = "Whether to enable";
             this.cB_enable.UseVisualStyleBackColor = true;
@@ -74,42 +75,47 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             // label2
             // 
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(32, 40);
+            this.label2.Location = new System.Drawing.Point(24, 32);
+            this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(23, 15);
+            this.label2.Size = new System.Drawing.Size(17, 12);
             this.label2.TabIndex = 2;
             this.label2.Text = "X:";
             // 
             // tB_FirstPointX
             // 
-            this.tB_FirstPointX.Location = new System.Drawing.Point(68, 37);
+            this.tB_FirstPointX.Location = new System.Drawing.Point(51, 30);
+            this.tB_FirstPointX.Margin = new System.Windows.Forms.Padding(2);
             this.tB_FirstPointX.Name = "tB_FirstPointX";
             this.tB_FirstPointX.ReadOnly = true;
-            this.tB_FirstPointX.Size = new System.Drawing.Size(100, 25);
+            this.tB_FirstPointX.Size = new System.Drawing.Size(76, 21);
             this.tB_FirstPointX.TabIndex = 3;
             // 
             // label3
             // 
             this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(196, 40);
+            this.label3.Location = new System.Drawing.Point(147, 32);
+            this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(23, 15);
+            this.label3.Size = new System.Drawing.Size(17, 12);
             this.label3.TabIndex = 4;
             this.label3.Text = "Y:";
             // 
             // tB_FirstPointY
             // 
-            this.tB_FirstPointY.Location = new System.Drawing.Point(232, 37);
+            this.tB_FirstPointY.Location = new System.Drawing.Point(174, 30);
+            this.tB_FirstPointY.Margin = new System.Windows.Forms.Padding(2);
             this.tB_FirstPointY.Name = "tB_FirstPointY";
             this.tB_FirstPointY.ReadOnly = true;
-            this.tB_FirstPointY.Size = new System.Drawing.Size(100, 25);
+            this.tB_FirstPointY.Size = new System.Drawing.Size(76, 21);
             this.tB_FirstPointY.TabIndex = 5;
             // 
             // bn_FirstPoint
             // 
-            this.bn_FirstPoint.Location = new System.Drawing.Point(647, 37);
+            this.bn_FirstPoint.Location = new System.Drawing.Point(485, 30);
+            this.bn_FirstPoint.Margin = new System.Windows.Forms.Padding(2);
             this.bn_FirstPoint.Name = "bn_FirstPoint";
-            this.bn_FirstPoint.Size = new System.Drawing.Size(96, 25);
+            this.bn_FirstPoint.Size = new System.Drawing.Size(72, 20);
             this.bn_FirstPoint.TabIndex = 6;
             this.bn_FirstPoint.Text = "obtain";
             this.bn_FirstPoint.UseVisualStyleBackColor = true;
@@ -117,9 +123,10 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             // 
             // bn_SecondPoint
             // 
-            this.bn_SecondPoint.Location = new System.Drawing.Point(647, 35);
+            this.bn_SecondPoint.Location = new System.Drawing.Point(485, 28);
+            this.bn_SecondPoint.Margin = new System.Windows.Forms.Padding(2);
             this.bn_SecondPoint.Name = "bn_SecondPoint";
-            this.bn_SecondPoint.Size = new System.Drawing.Size(96, 25);
+            this.bn_SecondPoint.Size = new System.Drawing.Size(72, 20);
             this.bn_SecondPoint.TabIndex = 12;
             this.bn_SecondPoint.Text = "obtain";
             this.bn_SecondPoint.UseVisualStyleBackColor = true;
@@ -127,43 +134,48 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             // 
             // tB_SecondPointY
             // 
-            this.tB_SecondPointY.Location = new System.Drawing.Point(232, 38);
+            this.tB_SecondPointY.Location = new System.Drawing.Point(174, 30);
+            this.tB_SecondPointY.Margin = new System.Windows.Forms.Padding(2);
             this.tB_SecondPointY.Name = "tB_SecondPointY";
             this.tB_SecondPointY.ReadOnly = true;
-            this.tB_SecondPointY.Size = new System.Drawing.Size(100, 25);
+            this.tB_SecondPointY.Size = new System.Drawing.Size(76, 21);
             this.tB_SecondPointY.TabIndex = 11;
             // 
             // label4
             // 
             this.label4.AutoSize = true;
-            this.label4.Location = new System.Drawing.Point(196, 42);
+            this.label4.Location = new System.Drawing.Point(147, 34);
+            this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(23, 15);
+            this.label4.Size = new System.Drawing.Size(17, 12);
             this.label4.TabIndex = 10;
             this.label4.Text = "Y:";
             // 
             // tB_SecondPointX
             // 
-            this.tB_SecondPointX.Location = new System.Drawing.Point(68, 38);
+            this.tB_SecondPointX.Location = new System.Drawing.Point(51, 30);
+            this.tB_SecondPointX.Margin = new System.Windows.Forms.Padding(2);
             this.tB_SecondPointX.Name = "tB_SecondPointX";
             this.tB_SecondPointX.ReadOnly = true;
-            this.tB_SecondPointX.Size = new System.Drawing.Size(100, 25);
+            this.tB_SecondPointX.Size = new System.Drawing.Size(76, 21);
             this.tB_SecondPointX.TabIndex = 9;
             // 
             // label5
             // 
             this.label5.AutoSize = true;
-            this.label5.Location = new System.Drawing.Point(32, 42);
+            this.label5.Location = new System.Drawing.Point(24, 34);
+            this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label5.Name = "label5";
-            this.label5.Size = new System.Drawing.Size(23, 15);
+            this.label5.Size = new System.Drawing.Size(17, 12);
             this.label5.TabIndex = 8;
             this.label5.Text = "X:";
             // 
             // bn_ThirdPoint
             // 
-            this.bn_ThirdPoint.Location = new System.Drawing.Point(647, 37);
+            this.bn_ThirdPoint.Location = new System.Drawing.Point(485, 30);
+            this.bn_ThirdPoint.Margin = new System.Windows.Forms.Padding(2);
             this.bn_ThirdPoint.Name = "bn_ThirdPoint";
-            this.bn_ThirdPoint.Size = new System.Drawing.Size(96, 25);
+            this.bn_ThirdPoint.Size = new System.Drawing.Size(72, 20);
             this.bn_ThirdPoint.TabIndex = 18;
             this.bn_ThirdPoint.Text = "obtain";
             this.bn_ThirdPoint.UseVisualStyleBackColor = true;
@@ -171,35 +183,39 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             // 
             // tB_ThirdPointY
             // 
-            this.tB_ThirdPointY.Location = new System.Drawing.Point(232, 37);
+            this.tB_ThirdPointY.Location = new System.Drawing.Point(174, 30);
+            this.tB_ThirdPointY.Margin = new System.Windows.Forms.Padding(2);
             this.tB_ThirdPointY.Name = "tB_ThirdPointY";
             this.tB_ThirdPointY.ReadOnly = true;
-            this.tB_ThirdPointY.Size = new System.Drawing.Size(100, 25);
+            this.tB_ThirdPointY.Size = new System.Drawing.Size(76, 21);
             this.tB_ThirdPointY.TabIndex = 17;
             // 
             // label7
             // 
             this.label7.AutoSize = true;
-            this.label7.Location = new System.Drawing.Point(196, 40);
+            this.label7.Location = new System.Drawing.Point(147, 32);
+            this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label7.Name = "label7";
-            this.label7.Size = new System.Drawing.Size(23, 15);
+            this.label7.Size = new System.Drawing.Size(17, 12);
             this.label7.TabIndex = 16;
             this.label7.Text = "Y:";
             // 
             // tB_ThirdPointX
             // 
-            this.tB_ThirdPointX.Location = new System.Drawing.Point(68, 37);
+            this.tB_ThirdPointX.Location = new System.Drawing.Point(51, 30);
+            this.tB_ThirdPointX.Margin = new System.Windows.Forms.Padding(2);
             this.tB_ThirdPointX.Name = "tB_ThirdPointX";
             this.tB_ThirdPointX.ReadOnly = true;
-            this.tB_ThirdPointX.Size = new System.Drawing.Size(100, 25);
+            this.tB_ThirdPointX.Size = new System.Drawing.Size(76, 21);
             this.tB_ThirdPointX.TabIndex = 15;
             // 
             // label9
             // 
             this.label9.AutoSize = true;
-            this.label9.Location = new System.Drawing.Point(32, 40);
+            this.label9.Location = new System.Drawing.Point(24, 32);
+            this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label9.Name = "label9";
-            this.label9.Size = new System.Drawing.Size(23, 15);
+            this.label9.Size = new System.Drawing.Size(17, 12);
             this.label9.TabIndex = 13;
             this.label9.Text = "X:";
             // 
@@ -212,27 +228,31 @@ 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, 59);
+            this.groupBox1.Location = new System.Drawing.Point(11, 47);
+            this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox1.Name = "groupBox1";
-            this.groupBox1.Size = new System.Drawing.Size(749, 89);
+            this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
+            this.groupBox1.Size = new System.Drawing.Size(562, 71);
             this.groupBox1.TabIndex = 19;
             this.groupBox1.TabStop = false;
             this.groupBox1.Text = "FirstPoint";
             // 
             // tB_FirstPointD
             // 
-            this.tB_FirstPointD.Location = new System.Drawing.Point(504, 37);
+            this.tB_FirstPointD.Location = new System.Drawing.Point(378, 30);
+            this.tB_FirstPointD.Margin = new System.Windows.Forms.Padding(2);
             this.tB_FirstPointD.Name = "tB_FirstPointD";
             this.tB_FirstPointD.ReadOnly = true;
-            this.tB_FirstPointD.Size = new System.Drawing.Size(109, 25);
+            this.tB_FirstPointD.Size = new System.Drawing.Size(83, 21);
             this.tB_FirstPointD.TabIndex = 8;
             // 
             // label8
             // 
             this.label8.AutoSize = true;
-            this.label8.Location = new System.Drawing.Point(401, 40);
+            this.label8.Location = new System.Drawing.Point(301, 32);
+            this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label8.Name = "label8";
-            this.label8.Size = new System.Drawing.Size(79, 15);
+            this.label8.Size = new System.Drawing.Size(59, 12);
             this.label8.TabIndex = 7;
             this.label8.Text = "Distance:";
             // 
@@ -245,27 +265,31 @@ 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, 181);
+            this.groupBox2.Location = new System.Drawing.Point(11, 145);
+            this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox2.Name = "groupBox2";
-            this.groupBox2.Size = new System.Drawing.Size(749, 95);
+            this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
+            this.groupBox2.Size = new System.Drawing.Size(562, 76);
             this.groupBox2.TabIndex = 7;
             this.groupBox2.TabStop = false;
             this.groupBox2.Text = "SecondPoint";
             // 
             // tB_SecondPointD
             // 
-            this.tB_SecondPointD.Location = new System.Drawing.Point(504, 38);
+            this.tB_SecondPointD.Location = new System.Drawing.Point(378, 30);
+            this.tB_SecondPointD.Margin = new System.Windows.Forms.Padding(2);
             this.tB_SecondPointD.Name = "tB_SecondPointD";
             this.tB_SecondPointD.ReadOnly = true;
-            this.tB_SecondPointD.Size = new System.Drawing.Size(100, 25);
+            this.tB_SecondPointD.Size = new System.Drawing.Size(76, 21);
             this.tB_SecondPointD.TabIndex = 23;
             // 
             // label6
             // 
             this.label6.AutoSize = true;
-            this.label6.Location = new System.Drawing.Point(401, 42);
+            this.label6.Location = new System.Drawing.Point(301, 34);
+            this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label6.Name = "label6";
-            this.label6.Size = new System.Drawing.Size(79, 15);
+            this.label6.Size = new System.Drawing.Size(59, 12);
             this.label6.TabIndex = 22;
             this.label6.Text = "Distance:";
             // 
@@ -278,35 +302,40 @@ 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, 312);
+            this.groupBox3.Location = new System.Drawing.Point(11, 250);
+            this.groupBox3.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox3.Name = "groupBox3";
-            this.groupBox3.Size = new System.Drawing.Size(749, 93);
+            this.groupBox3.Padding = new System.Windows.Forms.Padding(2);
+            this.groupBox3.Size = new System.Drawing.Size(562, 74);
             this.groupBox3.TabIndex = 13;
             this.groupBox3.TabStop = false;
             this.groupBox3.Text = "ThirdPoint";
             // 
             // tB_ThirdPointD
             // 
-            this.tB_ThirdPointD.Location = new System.Drawing.Point(504, 37);
+            this.tB_ThirdPointD.Location = new System.Drawing.Point(378, 30);
+            this.tB_ThirdPointD.Margin = new System.Windows.Forms.Padding(2);
             this.tB_ThirdPointD.Name = "tB_ThirdPointD";
             this.tB_ThirdPointD.ReadOnly = true;
-            this.tB_ThirdPointD.Size = new System.Drawing.Size(100, 25);
+            this.tB_ThirdPointD.Size = new System.Drawing.Size(76, 21);
             this.tB_ThirdPointD.TabIndex = 22;
             // 
             // label1
             // 
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(401, 40);
+            this.label1.Location = new System.Drawing.Point(301, 32);
+            this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(86, 15);
+            this.label1.Size = new System.Drawing.Size(65, 12);
             this.label1.TabIndex = 21;
             this.label1.Text = "DiStance:";
             // 
             // bn_OK
             // 
-            this.bn_OK.Location = new System.Drawing.Point(667, 428);
+            this.bn_OK.Location = new System.Drawing.Point(399, 340);
+            this.bn_OK.Margin = new System.Windows.Forms.Padding(2);
             this.bn_OK.Name = "bn_OK";
-            this.bn_OK.Size = new System.Drawing.Size(97, 32);
+            this.bn_OK.Size = new System.Drawing.Size(73, 26);
             this.bn_OK.TabIndex = 20;
             this.bn_OK.Text = "OK";
             this.bn_OK.UseVisualStyleBackColor = true;
@@ -314,9 +343,10 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             // 
             // bn_Cancel
             // 
-            this.bn_Cancel.Location = new System.Drawing.Point(537, 428);
+            this.bn_Cancel.Location = new System.Drawing.Point(496, 340);
+            this.bn_Cancel.Margin = new System.Windows.Forms.Padding(2);
             this.bn_Cancel.Name = "bn_Cancel";
-            this.bn_Cancel.Size = new System.Drawing.Size(91, 32);
+            this.bn_Cancel.Size = new System.Drawing.Size(68, 26);
             this.bn_Cancel.TabIndex = 21;
             this.bn_Cancel.Text = "Cancel";
             this.bn_Cancel.UseVisualStyleBackColor = true;
@@ -324,20 +354,21 @@ namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
             // 
             // SlopFocus
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(772, 481);
+            this.ClientSize = new System.Drawing.Size(580, 391);
             this.Controls.Add(this.bn_Cancel);
             this.Controls.Add(this.bn_OK);
             this.Controls.Add(this.groupBox3);
             this.Controls.Add(this.groupBox2);
             this.Controls.Add(this.groupBox1);
             this.Controls.Add(this.cB_enable);
+            this.Margin = new System.Windows.Forms.Padding(2);
             this.MaximizeBox = false;
-            this.MaximumSize = new System.Drawing.Size(790, 528);
-            this.MinimumSize = new System.Drawing.Size(790, 528);
+            this.MaximumSize = new System.Drawing.Size(596, 430);
+            this.MinimumSize = new System.Drawing.Size(596, 430);
             this.Name = "SlopFocus";
-            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.Text = "SlopFocus";
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SlopFocus_FormClosing);
             this.Load += new System.EventHandler(this.SlopFocus_Load);

+ 26 - 12
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/frmSpecialGrayParticle.Designer.cs

@@ -34,11 +34,12 @@
             this.nuDownGrayEnd = new System.Windows.Forms.NumericUpDown();
             this.label2 = new System.Windows.Forms.Label();
             this.btnYes = new System.Windows.Forms.Button();
-            this.btnCancel = new System.Windows.Forms.Button();
+            this.btnOk = new System.Windows.Forms.Button();
             this.tbGrayEnd = new System.Windows.Forms.TrackBar();
             this.txtGrayStart = new System.Windows.Forms.TextBox();
             this.txtGrayEnd = new System.Windows.Forms.TextBox();
             this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.button1 = new System.Windows.Forms.Button();
             this.pbBSEImage = new System.Windows.Forms.PictureBox();
             ((System.ComponentModel.ISupportInitialize)(this.tbGrayStart)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.nuDownGrayStart)).BeginInit();
@@ -113,16 +114,16 @@
             this.btnYes.UseVisualStyleBackColor = true;
             this.btnYes.Click += new System.EventHandler(this.btnYes_Click);
             // 
-            // btnCancel
+            // btnOk
             // 
-            this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
-            this.btnCancel.Location = new System.Drawing.Point(927, 16);
-            this.btnCancel.Name = "btnCancel";
-            this.btnCancel.Size = new System.Drawing.Size(75, 51);
-            this.btnCancel.TabIndex = 10;
-            this.btnCancel.Text = "退出";
-            this.btnCancel.UseVisualStyleBackColor = true;
-            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+            this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.btnOk.Location = new System.Drawing.Point(795, 23);
+            this.btnOk.Name = "btnOk";
+            this.btnOk.Size = new System.Drawing.Size(75, 36);
+            this.btnOk.TabIndex = 10;
+            this.btnOk.Text = "确定";
+            this.btnOk.UseVisualStyleBackColor = true;
+            this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
             // 
             // tbGrayEnd
             // 
@@ -155,7 +156,8 @@
             this.groupBox1.Controls.Add(this.txtGrayEnd);
             this.groupBox1.Controls.Add(this.txtGrayStart);
             this.groupBox1.Controls.Add(this.tbGrayEnd);
-            this.groupBox1.Controls.Add(this.btnCancel);
+            this.groupBox1.Controls.Add(this.button1);
+            this.groupBox1.Controls.Add(this.btnOk);
             this.groupBox1.Controls.Add(this.btnYes);
             this.groupBox1.Controls.Add(this.label2);
             this.groupBox1.Controls.Add(this.nuDownGrayEnd);
@@ -170,6 +172,17 @@
             this.groupBox1.TabStop = false;
             this.groupBox1.Text = "设置参数";
             // 
+            // button1
+            // 
+            this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.button1.Location = new System.Drawing.Point(889, 23);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(75, 36);
+            this.button1.TabIndex = 10;
+            this.button1.Text = "取消";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.btnCancel_Click);
+            // 
             // pbBSEImage
             // 
             this.pbBSEImage.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -210,11 +223,12 @@
         private System.Windows.Forms.NumericUpDown nuDownGrayEnd;
         private System.Windows.Forms.Label label2;
         private System.Windows.Forms.Button btnYes;
-        private System.Windows.Forms.Button btnCancel;
+        private System.Windows.Forms.Button btnOk;
         private System.Windows.Forms.TrackBar tbGrayEnd;
         private System.Windows.Forms.TextBox txtGrayStart;
         private System.Windows.Forms.TextBox txtGrayEnd;
         private System.Windows.Forms.GroupBox groupBox1;
         private System.Windows.Forms.PictureBox pbBSEImage;
+        private System.Windows.Forms.Button button1;
     }
 }

+ 9 - 0
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/frmSpecialGrayParticle.cs

@@ -348,6 +348,15 @@ namespace OTSMeasureApp
             }
             return null;
         }
+
         #endregion
+
+        private void btnOk_Click(object sender, EventArgs e)
+        {
+            this.bseGrayMinValue = Convert.ToInt32(txtGrayStart.Text);
+            this.bseGrayMaxValue = Convert.ToInt32(txtGrayEnd.Text);
+            this.DialogResult = DialogResult.OK;
+            
+        }
     }
 }

+ 24 - 39
OTSIncAMeasureApp/7-OTSProgMgrInfo/ProgMgrInfoForm.cs

@@ -159,19 +159,7 @@ namespace OTSMeasureApp
             if (IDC_COMBO_YDIRECT.Items.Count > 0)
                 IDC_COMBO_YDIRECT.SelectedIndex = 0;
             this.IDC_COMBO_YDIRECT.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_YDIRECT_SelectedIndexChanged);
-            ////测量终止方式
-            //IDC_COMBO_STOPMODE.Items.Clear();
-            //foreach (otsdataconst.OTS_MEASURE_STOP_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_MEASURE_STOP_MODE)))
-            //{
-            //    ComboBoxItem cbi = new ComboBoxItem();
-            //    cbi.Text = GetStopModeIdString(enum_one);
-            //    cbi.Value = (int)enum_one;
-            //    IDC_COMBO_STOPMODE.Items.Add(cbi);
-            //}
-            //this.IDC_COMBO_STOPMODE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_STOPMODE_SelectedIndexChanged);
-            //if (IDC_COMBO_STOPMODE.Items.Count > 0)
-            //    IDC_COMBO_STOPMODE.SelectedIndex = 0;
-            //this.IDC_COMBO_STOPMODE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_STOPMODE_SelectedIndexChanged);
+     
             //取图方式
             IDC_COMBO_FETCHIMGMODE.Items.Clear();
             foreach (otsdataconst.OTS_GET_IMAGE_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_GET_IMAGE_MODE)))
@@ -266,10 +254,7 @@ namespace OTSMeasureApp
                 cbi.Value = i;
                 IDC_COMBO_CorrosionExpansionCoefficient.Items.Add(cbi);
             }
-            //this.IDC_COMBO_CorrosionExpansionCoefficient.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_CorrosionExpansionCoefficient_SelectedIndexChanged);
-            //if (IDC_COMBO_CorrosionExpansionCoefficient.Items.Count > 0)
-            //    IDC_COMBO_CorrosionExpansionCoefficient.SelectedIndex = 0;
-            //this.IDC_COMBO_CorrosionExpansionCoefficient.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_CorrosionExpansionCoefficient_SelectedIndexChanged);
+
 
             //X-Ray扫描方式
             IDC_COMBO_XRAYSCANMODE.Items.Clear();
@@ -972,18 +957,18 @@ namespace OTSMeasureApp
                 btnok.Enabled = false;
 
             //获取特殊颗粒信息
-            DataTable dt = XMLoperate.GetXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData").Tables[0];
-            if (dt.Rows.Count != 0)
-            {
-                if (XMLoperate.GetXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData").Tables[0].Rows[0]["ToRun"].ToString() == "true")
-                {
-                    checkBox_Run.Checked = true;
-                }
-                else
-                {
-                    checkBox_Run.Checked = false;
-                }
-            }
+            //DataTable dt = XMLoperate.GetXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData").Tables[0];
+            //if (dt.Rows.Count != 0)
+            //{
+            //    if (XMLoperate.GetXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData").Tables[0].Rows[0]["ToRun"].ToString() == "true")
+            //    {
+            //        checkBox_Run.Checked = true;
+            //    }
+            //    else
+            //    {
+            //        checkBox_Run.Checked = false;
+            //    }
+            //}
 
             //关于路径定位问题
             this.folderBrowserDialog1.SelectedPath = IDC_EDIT_MEASUREPARAMPATH.Text;
@@ -2092,20 +2077,20 @@ namespace OTSMeasureApp
         private void button_SpPart_Click(object sender, EventArgs e)
         {
             //System.Diagnostics.Process.Start("notepad.exe", CSpecialGrayRangeParam.GetParamFileFullName());
-            SpecialParticleForm specialParticleForm = new SpecialParticleForm(CSpecialGrayRangeParam.GetParamFileFullName());
-            specialParticleForm.ShowDialog();
+            //SpecialParticleForm specialParticleForm = new SpecialParticleForm(CSpecialGrayRangeParam.GetParamFileFullName());
+            //specialParticleForm.ShowDialog();
         }
 
         private void checkBox_Run_CheckedChanged(object sender, EventArgs e)
         {
-            if (checkBox_Run.Checked)
-            {
-                XMLoperate.UpdateXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData", "0", "ToRun", "true");
-            }
-            else
-            {
-                XMLoperate.UpdateXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData", "0", "ToRun", "false");
-            }
+            //if (checkBox_Run.Checked)
+            //{
+            //    XMLoperate.UpdateXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData", "0", "ToRun", "true");
+            //}
+            //else
+            //{
+            //    XMLoperate.UpdateXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData", "0", "ToRun", "false");
+            //}
         }
     }
     public class ComboBoxItem

+ 0 - 27
OTSIncAMeasureApp/7-OTSProgMgrInfo/ProgMgrInfoForm.designer.cs

@@ -95,10 +95,8 @@
             this.label14 = new System.Windows.Forms.Label();
             this.IDC_BUTTON_MEASPRAMPATHSET = new System.Windows.Forms.Button();
             this.groupBox5 = new System.Windows.Forms.GroupBox();
-            this.checkBox_Run = new System.Windows.Forms.CheckBox();
             this.IDC_COMBO_CorrosionExpansionCoefficient = new System.Windows.Forms.ComboBox();
             this.label49 = new System.Windows.Forms.Label();
-            this.button_SpPart = new System.Windows.Forms.Button();
             this.IDC_COMBO_AUTOBGREMOVETYP = new System.Windows.Forms.ComboBox();
             this.label_Auto = new System.Windows.Forms.Label();
             this.IDC_COMBO_BGREMOVETYPE = new System.Windows.Forms.ComboBox();
@@ -921,10 +919,8 @@
             // 
             // groupBox5
             // 
-            this.groupBox5.Controls.Add(this.checkBox_Run);
             this.groupBox5.Controls.Add(this.IDC_COMBO_CorrosionExpansionCoefficient);
             this.groupBox5.Controls.Add(this.label49);
-            this.groupBox5.Controls.Add(this.button_SpPart);
             this.groupBox5.Controls.Add(this.IDC_COMBO_AUTOBGREMOVETYP);
             this.groupBox5.Controls.Add(this.label_Auto);
             this.groupBox5.Controls.Add(this.IDC_COMBO_BGREMOVETYPE);
@@ -953,17 +949,6 @@
             this.groupBox5.TabStop = false;
             this.groupBox5.Text = "图像处理参数";
             // 
-            // checkBox_Run
-            // 
-            this.checkBox_Run.AutoSize = true;
-            this.checkBox_Run.Location = new System.Drawing.Point(217, 194);
-            this.checkBox_Run.Name = "checkBox_Run";
-            this.checkBox_Run.Size = new System.Drawing.Size(72, 16);
-            this.checkBox_Run.TabIndex = 826;
-            this.checkBox_Run.Text = "是否启用";
-            this.checkBox_Run.UseVisualStyleBackColor = true;
-            this.checkBox_Run.CheckedChanged += new System.EventHandler(this.checkBox_Run_CheckedChanged);
-            // 
             // IDC_COMBO_CorrosionExpansionCoefficient
             // 
             this.IDC_COMBO_CorrosionExpansionCoefficient.FormattingEnabled = true;
@@ -984,16 +969,6 @@
             this.label49.TabIndex = 824;
             this.label49.Text = "腐蚀膨胀系数";
             // 
-            // button_SpPart
-            // 
-            this.button_SpPart.Location = new System.Drawing.Point(14, 190);
-            this.button_SpPart.Name = "button_SpPart";
-            this.button_SpPart.Size = new System.Drawing.Size(195, 22);
-            this.button_SpPart.TabIndex = 823;
-            this.button_SpPart.Text = "特殊灰度颗粒识别设置";
-            this.button_SpPart.UseVisualStyleBackColor = true;
-            this.button_SpPart.Click += new System.EventHandler(this.button_SpPart_Click);
-            // 
             // IDC_COMBO_AUTOBGREMOVETYP
             // 
             this.IDC_COMBO_AUTOBGREMOVETYP.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@@ -1826,7 +1801,6 @@
         public System.Windows.Forms.ComboBox IDC_COMBO_Model;
         private System.Windows.Forms.GroupBox groupBox7;
         public System.Windows.Forms.CheckBox IDC_USINGXRAY_LIB;
-        private System.Windows.Forms.Button button_SpPart;
         public System.Windows.Forms.TextBox IDC_EDIT_SmallPartAQTime;
         private System.Windows.Forms.Label label45;
         private System.Windows.Forms.Label label46;
@@ -1841,6 +1815,5 @@
         private System.Windows.Forms.Label label48;
         private System.Windows.Forms.ComboBox IDC_COMBO_CorrosionExpansionCoefficient;
         private System.Windows.Forms.Label label49;
-        private System.Windows.Forms.CheckBox checkBox_Run;
     }
 }

+ 116 - 25
OTSIncAMeasureApp/7-OTSProgMgrInfo/SpecialParticleForm.Designer.cs

@@ -1,5 +1,5 @@
 
-namespace OTSMeasureApp._7_OTSProgMgrInfo
+namespace OTSMeasureApp
 {
     partial class SpecialParticleForm
     {
@@ -29,35 +29,44 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo
         /// </summary>
         private void InitializeComponent()
         {
-            this.dataGridView_xml = new System.Windows.Forms.DataGridView();
+            this.dg1 = new System.Windows.Forms.DataGridView();
             this.RegName = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.start = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.end = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.diameterStart = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.diameterEnd = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            this.collectXray = new System.Windows.Forms.DataGridViewTextBoxColumn();
-            ((System.ComponentModel.ISupportInitialize)(this.dataGridView_xml)).BeginInit();
+            this.collectXray = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.rangeChoose = new System.Windows.Forms.DataGridViewButtonColumn();
+            this.confirm = new System.Windows.Forms.Button();
+            this.button2 = new System.Windows.Forms.Button();
+            this.button1 = new System.Windows.Forms.Button();
+            this.button3 = new System.Windows.Forms.Button();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.checkBox1 = new System.Windows.Forms.CheckBox();
+            ((System.ComponentModel.ISupportInitialize)(this.dg1)).BeginInit();
+            this.groupBox1.SuspendLayout();
             this.SuspendLayout();
             // 
-            // dataGridView_xml
+            // dg1
             // 
-            this.dataGridView_xml.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
-            this.dataGridView_xml.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+            this.dg1.AllowUserToAddRows = false;
+            this.dg1.AllowUserToDeleteRows = false;
+            this.dg1.AllowUserToOrderColumns = true;
+            this.dg1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            this.dg1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.RegName,
             this.start,
             this.end,
             this.diameterStart,
             this.diameterEnd,
-            this.collectXray});
-            this.dataGridView_xml.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.dataGridView_xml.Location = new System.Drawing.Point(0, 0);
-            this.dataGridView_xml.Name = "dataGridView_xml";
-            this.dataGridView_xml.RowTemplate.Height = 23;
-            this.dataGridView_xml.Size = new System.Drawing.Size(784, 314);
-            this.dataGridView_xml.TabIndex = 2;
-            this.dataGridView_xml.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_xml_CellValueChanged);
-            this.dataGridView_xml.DefaultValuesNeeded += new System.Windows.Forms.DataGridViewRowEventHandler(this.dataGridView_xml_DefaultValuesNeeded);
-            this.dataGridView_xml.UserDeletingRow += new System.Windows.Forms.DataGridViewRowCancelEventHandler(this.dataGridView_xml_UserDeletingRow);
+            this.collectXray,
+            this.rangeChoose});
+            this.dg1.Location = new System.Drawing.Point(2, 2);
+            this.dg1.Name = "dg1";
+            this.dg1.RowTemplate.Height = 23;
+            this.dg1.Size = new System.Drawing.Size(779, 312);
+            this.dg1.TabIndex = 2;
+            this.dg1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dg1_CellContentClick);
             // 
             // RegName
             // 
@@ -100,31 +109,113 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo
             this.collectXray.DataPropertyName = "collectXray";
             this.collectXray.HeaderText = "是否采集Xray";
             this.collectXray.Name = "collectXray";
+            this.collectXray.Resizable = System.Windows.Forms.DataGridViewTriState.True;
+            this.collectXray.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
+            // 
+            // rangeChoose
+            // 
+            this.rangeChoose.HeaderText = "可视化选择";
+            this.rangeChoose.Name = "rangeChoose";
+            this.rangeChoose.Text = "灰度选择";
+            this.rangeChoose.UseColumnTextForButtonValue = true;
+            // 
+            // confirm
+            // 
+            this.confirm.Location = new System.Drawing.Point(538, 378);
+            this.confirm.Name = "confirm";
+            this.confirm.Size = new System.Drawing.Size(87, 25);
+            this.confirm.TabIndex = 3;
+            this.confirm.Text = "确定";
+            this.confirm.UseVisualStyleBackColor = true;
+            this.confirm.Click += new System.EventHandler(this.confirm_Click);
+            // 
+            // button2
+            // 
+            this.button2.Location = new System.Drawing.Point(646, 378);
+            this.button2.Name = "button2";
+            this.button2.Size = new System.Drawing.Size(87, 24);
+            this.button2.TabIndex = 4;
+            this.button2.Text = "取消";
+            this.button2.UseVisualStyleBackColor = true;
+            this.button2.Click += new System.EventHandler(this.button2_Click);
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(40, 378);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(66, 25);
+            this.button1.TabIndex = 5;
+            this.button1.Text = "增加";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // button3
+            // 
+            this.button3.Location = new System.Drawing.Point(130, 379);
+            this.button3.Name = "button3";
+            this.button3.Size = new System.Drawing.Size(62, 22);
+            this.button3.TabIndex = 6;
+            this.button3.Text = "删除";
+            this.button3.UseVisualStyleBackColor = true;
+            this.button3.Click += new System.EventHandler(this.button3_Click);
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Controls.Add(this.checkBox1);
+            this.groupBox1.Location = new System.Drawing.Point(4, 318);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Size = new System.Drawing.Size(776, 45);
+            this.groupBox1.TabIndex = 7;
+            this.groupBox1.TabStop = false;
+            // 
+            // checkBox1
+            // 
+            this.checkBox1.AutoSize = true;
+            this.checkBox1.Location = new System.Drawing.Point(21, 18);
+            this.checkBox1.Name = "checkBox1";
+            this.checkBox1.Size = new System.Drawing.Size(48, 16);
+            this.checkBox1.TabIndex = 0;
+            this.checkBox1.Text = "启用";
+            this.checkBox1.UseVisualStyleBackColor = true;
             // 
             // SpecialParticleForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(784, 314);
-            this.Controls.Add(this.dataGridView_xml);
-            this.MaximumSize = new System.Drawing.Size(800, 353);
-            this.MinimumSize = new System.Drawing.Size(800, 353);
+            this.ClientSize = new System.Drawing.Size(784, 414);
+            this.Controls.Add(this.groupBox1);
+            this.Controls.Add(this.button3);
+            this.Controls.Add(this.button1);
+            this.Controls.Add(this.button2);
+            this.Controls.Add(this.confirm);
+            this.Controls.Add(this.dg1);
+            this.MaximumSize = new System.Drawing.Size(800, 453);
+            this.MinimumSize = new System.Drawing.Size(800, 453);
             this.Name = "SpecialParticleForm";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
-            this.Text = "SpecialParticleForm";
-            ((System.ComponentModel.ISupportInitialize)(this.dataGridView_xml)).EndInit();
+            this.Text = "特殊灰度阈值颗粒提取";
+            ((System.ComponentModel.ISupportInitialize)(this.dg1)).EndInit();
+            this.groupBox1.ResumeLayout(false);
+            this.groupBox1.PerformLayout();
             this.ResumeLayout(false);
 
         }
 
         #endregion
 
-        private System.Windows.Forms.DataGridView dataGridView_xml;
+        private System.Windows.Forms.DataGridView dg1;
+        private System.Windows.Forms.Button confirm;
+        private System.Windows.Forms.Button button2;
+        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.Button button3;
+        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.CheckBox checkBox1;
         private System.Windows.Forms.DataGridViewTextBoxColumn RegName;
         private System.Windows.Forms.DataGridViewTextBoxColumn start;
         private System.Windows.Forms.DataGridViewTextBoxColumn end;
         private System.Windows.Forms.DataGridViewTextBoxColumn diameterStart;
         private System.Windows.Forms.DataGridViewTextBoxColumn diameterEnd;
-        private System.Windows.Forms.DataGridViewTextBoxColumn collectXray;
+        private System.Windows.Forms.DataGridViewCheckBoxColumn collectXray;
+        private System.Windows.Forms.DataGridViewButtonColumn rangeChoose;
     }
 }

+ 83 - 169
OTSIncAMeasureApp/7-OTSProgMgrInfo/SpecialParticleForm.cs

@@ -1,4 +1,5 @@
 using OTSCommon;
+using OTSModelSharp.ServiceInterface;
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -11,7 +12,7 @@ using System.Threading;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 
-namespace OTSMeasureApp._7_OTSProgMgrInfo
+namespace OTSMeasureApp
 {
     public partial class SpecialParticleForm : Form
     {
@@ -21,23 +22,33 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo
         private string str_end = "100";
         private string str_diameterStart = "0";
         private string str_diameterEnd = "100";
-        private string str_collectXray = "false";
-
+       
+        OTSIncAMeasureAppForm m_mainForm;
+         OTSMeasureStatusWindow m_measureStatuWindow;
+       byte[] m_BseData;
+        int m_imageWidth;
+        int m_imageHeight;
         //国际化
         OTSCommon.Language lan;
         Hashtable table;
 
-        public delegate void MyInvoke();
-        public void DoWork()
-        {
-            MyInvoke mi = new MyInvoke(ShowXmlInfo);
-            this.BeginInvoke(mi);
-        }
+        //the datasource of datagridview
+        DataSet ds1;
+       
+
 
-        public SpecialParticleForm(string xmlPath)
+        public SpecialParticleForm(string xmlPath, OTSIncAMeasureAppForm mainForm,byte[] bBseData,int width,int height, OTSMeasureStatusWindow measureStatuWindow)
         {
             InitializeComponent();
             this.xmlPath = xmlPath;
+            m_mainForm = mainForm;
+
+            m_measureStatuWindow = measureStatuWindow;
+
+            m_BseData = bBseData;
+            m_imageWidth = width;
+            m_imageHeight = height;
+
             ShowXmlInfo();
 
             //国际化
@@ -47,180 +58,83 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo
 
         private void ShowXmlInfo()
         {
-            DataSet dataSet = XMLoperate.GetXMLRegList(xmlPath, "Member");
-            dataGridView_xml.DataSource = dataSet.Tables[0];
+
+             ds1 = XMLoperate.GetXMLRegList(xmlPath, "Member");
+             dg1.DataSource = ds1.Tables[0];
+           
+            var ds2 = XMLoperate.GetXMLRegList(xmlPath, "XMLData");
+
+            var ifrun = Convert.ToBoolean(ds2.Tables[0].Rows[0]["ToRun"]);
+
+            checkBox1.Checked = ifrun;
         }
 
-        private void dataGridView_xml_CellValueChanged(object sender, DataGridViewCellEventArgs e)
+
+
+    
+
+        private void button1_Click(object sender, EventArgs e)
         {
-            if (e.RowIndex == -1 || e.ColumnIndex == -1)
-            {
-                return;
-            }
 
-            if (e.RowIndex == dataGridView_xml.Rows.Count - 1)
-            {
-                return;
-            }
+            var nr = ds1.Tables[0].NewRow();
+
+            nr["RegName"] = str_RegName;
+            nr["start"] = str_start;
+            nr["end"] = str_end;
+            nr["diameterStart"] = str_diameterStart;
+            nr["diameterEnd"] = str_diameterEnd;
+            nr["collectXray"] = "false";
+           
+            ds1.Tables[0].Rows.Add(nr);
+           
+        }
 
-            switch (e.ColumnIndex)
-            {
-                case 0://名称
-                    {
-                        for (int i = 0; i < dataGridView_xml.Rows.Count - 1; i++)
-                        {
-                            if (i != e.RowIndex)
-                            {
-                                if (dataGridView_xml.Rows[i].Cells[e.ColumnIndex].Value.ToString() == dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString())
-                                {
-                                    dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value += "_1";
-                                    break;
-                                }
-                            }
-                        }
-
-                        if (dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "")
-                        {
-                            dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value += "unknow";
-                        }
-
-                        break;
-                    }
-                case 1://开始灰度
-                    {
-                        int result = 0;
-                        int.TryParse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), out result);
-
-                        if (result == 0)
-                        {
-                            dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "0";
-                        }
-                        else
-                        {
-                            if (int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) > int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[2].Value.ToString()))
-                            {
-                                dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = dataGridView_xml.Rows[e.RowIndex].Cells[2].Value.ToString();
-                            }
-                            else if (int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) < 0 || int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) > 255)
-                            {
-                                dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "0";
-                            }
-                        }
-
-                        break;
-                    }
-                case 2://结束灰度
-                    {
-                        int result = 0;
-                        int.TryParse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), out result);
-
-                        if (result == 0)
-                        {
-                            dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "0";
-                        }
-                        else
-                        {
-                            if (int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) < int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[1].Value.ToString()))
-                            {
-                                dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = dataGridView_xml.Rows[e.RowIndex].Cells[1].Value.ToString();
-                            }
-                            else if (int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) < 0 || int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) > 255)
-                            {
-                                dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "0";
-                            }
-                        }
-
-                        break;
-                    }
-                case 3: //开始直径
-                    {
-                        int result = 0;
-                        int.TryParse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), out result);
-
-                        if (result == 0)
-                        {
-                            dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "0";
-                        }
-                        else
-                        {
-                            if (int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) > int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[4].Value.ToString()))
-                            {
-                                dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = dataGridView_xml.Rows[e.RowIndex].Cells[4].Value.ToString();
-                            }
-                            else if (int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) < 0 || int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) > 255)
-                            {
-                                dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "0";
-                            }
-                        }
-
-                        break;
-                    }
-                case 4: //结束直径
-                    {
-                        int result = 0;
-                        int.TryParse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), out result);
-
-                        if (result == 0)
-                        {
-                            dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "0";
-                        }
-                        else
-                        {
-                            if (int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) < int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[3].Value.ToString()))
-                            {
-                                dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = dataGridView_xml.Rows[e.RowIndex].Cells[3].Value.ToString();
-                            }
-                            else if (int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) < 0 || int.Parse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) > 255)
-                            {
-                                dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "0";
-                            }
-                        }
-
-                        break;
-                    }
-                case 5: //是否采集Xray
-                    {
-                        bool result = false;
-                        bool.TryParse(dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), out result);
-
-                        if (result == false)
-                        {
-                            dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "false";
-                        }
-                        break;
-                    }
-
-                default:
-                    break;
-            }
+        private void button3_Click(object sender, EventArgs e)
+        {
+            ds1.Tables[0].Rows.RemoveAt(dg1.CurrentRow.Index);
+        }
 
-            if (dataGridView_xml.Rows[e.RowIndex].Cells[0].Value.ToString() != "")
+        private void dg1_CellContentClick(object sender, DataGridViewCellEventArgs e)
+        {
+            if (dg1.Columns[e.ColumnIndex].Name == "rangeChoose" && e.RowIndex >= 0)
             {
-                XMLoperate.UpdateXMLRegList(xmlPath, "Member", e.RowIndex.ToString(), dataGridView_xml.Columns[e.ColumnIndex].Name, dataGridView_xml.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
+                frmSpecialGrayParticle toolWindow = new frmSpecialGrayParticle(m_mainForm, m_measureStatuWindow);
+                int grayStart = 0;
+                int grayEnd = 0;
+                if (m_BseData != null)
+                {
+                    Bitmap bitmap = CImageHandler.ToGrayBitmap(m_BseData, m_imageWidth, m_imageHeight);
+                    toolWindow.BseImg = bitmap;
+                    toolWindow.SetBBseData(m_BseData);
+     
+                    grayStart = Convert.ToInt32( dg1.Rows[e.RowIndex].Cells["start"].Value);
+                    grayEnd = Convert.ToInt32(dg1.Rows[e.RowIndex].Cells["end"].Value);
+                    //设置可视化中的属性
+                    toolWindow.BseGrayMinValue = grayStart;
+                    toolWindow.BseGrayMaxValue = grayEnd;
+                }
+                DialogResult dialogResult = toolWindow.ShowDialog();
+                if (dialogResult == DialogResult.OK)
+                {
+                    dg1.Rows[e.RowIndex].Cells["start"].Value = toolWindow.BseGrayMinValue;
+                    dg1.Rows[e.RowIndex].Cells["end"].Value = toolWindow.BseGrayMaxValue;
+                }
+
             }
         }
 
-        private void dataGridView_xml_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)
+        private void confirm_Click(object sender, EventArgs e)
         {
-            e.Row.Cells["RegName"].Value = str_RegName;
-            e.Row.Cells["start"].Value = str_start;
-            e.Row.Cells["end"].Value = str_end;
-            e.Row.Cells["diameterStart"].Value = str_diameterStart;
-            e.Row.Cells["diameterEnd"].Value = str_diameterEnd;
-            e.Row.Cells["collectXray"].Value = str_collectXray;
+            XMLoperate.UpdateSpecialGrayXMLFile(xmlPath, dg1, checkBox1.Checked);
+            this.Close();
 
-            XMLoperate.AddXMLRegList(xmlPath, str_RegName, str_start, str_end, str_diameterStart, str_diameterEnd, str_collectXray);
-
-            Thread thread = new Thread(DoWork);
-            thread.Start();
         }
 
-        private void dataGridView_xml_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
+        private void button2_Click(object sender, EventArgs e)
         {
-            XMLoperate.DeleteXMLRegList(xmlPath, "Member", e.Row.Index);
-
-            Thread thread = new Thread(DoWork);
-            thread.Start();
+            this.Close();
         }
+
+      
     }
 }

+ 3 - 0
OTSIncAMeasureApp/7-OTSProgMgrInfo/SpecialParticleForm.resx

@@ -135,4 +135,7 @@
   <metadata name="collectXray.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
+  <metadata name="rangeChoose.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+    <value>True</value>
+  </metadata>
 </root>

+ 1 - 1
OTSIncAMeasureApp/OTSIncAMeasureApp.csproj

@@ -70,7 +70,7 @@
     <DebugSymbols>true</DebugSymbols>
     <OutputPath>..\Bin\x64\Debug\</OutputPath>
     <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DebugType>full</DebugType>
     <PlatformTarget>x64</PlatformTarget>
     <LangVersion>7.3</LangVersion>

+ 1 - 1
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.cs

@@ -81,7 +81,7 @@ namespace OTSIncAReportGrids
         //测量结果
         ResultFile result = null;
         string str_SysType = "";//当前启动模式(夹杂物、清洁度)
-        frmReMeasure frmReMeasure = new frmReMeasure();
+        //frmReMeasure frmReMeasure = new frmReMeasure();
 
         frmReportConditionChoose m_condition;
         FieldData fieldData;