瀏覽代碼

修改标准库编辑器bug
优化组编辑器

cxs 3 月之前
父節點
當前提交
15273a9e67

+ 3 - 3
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="6">
+<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:ROUND" />
@@ -79,7 +79,7 @@
       </Collection>
     </Member>
     <Member strName="Cleanness三孔样品台">
-      <Member RegName="boundary" PolygonPoint="" rectDomian="0,0,120000,120000" shape="1:RECTANGLE" />
+      <Member RegName="boundary" PolygonPoint="" rectDomian="0,0,110000,110000" shape="1:RECTANGLE" />
       <Member RegName="std" PolygonPoint="" rectDomian="0,0,2,2" shape="1:RECTANGLE" />
       <Collection RegName="Holes">
         <Member HoleName="1" rectDomian="0,27140,47000,0" shape="0" />
@@ -88,7 +88,7 @@
       </Collection>
     </Member>
     <Member strName="Cleanness四孔方形台">
-      <Member RegName="boundary" PolygonPoint="" rectDomian="0,0,94000,94000" shape="1:RECTANGLE" />
+      <Member RegName="boundary" PolygonPoint="" rectDomian="0,0,110000,110000" shape="1:RECTANGLE" />
       <Member RegName="std" PolygonPoint="" rectDomian="0,0,2,0" shape="0:ROUND" />
       <Collection RegName="Holes">
         <Member HoleName="1" rectDomian="-23500,23500,47000,0" shape="0" />

+ 17 - 0
Bin/x64/Debug/Resources/XMLData/AppResource_ZH.xml

@@ -124,6 +124,23 @@
 	  <Control name="str2" text="连接" />
      </Controls>
   </Form>
+  <Form>
+  <Name>StageTest</Name>
+    <Controls>
+	   <Control name="message1" text="请输入要设置的参数!" />
+	  <Control name="message2" text="连接硬件设备成功!" />
+	  <Control name="message3" text="连接硬件设备失败!" />
+	  <Control name="message4" text="设置成功!" />
+	  <Control name="message5" text="设置失败,请检查硬件是否连接!" />
+	  <Control name="message6" text="获取成功!" />
+	  <Control name="message7" text="获取失败,请检查硬件是否连接!" />
+	  <Control name="message8" text="设置的内容格式有错误!" />
+	  <Control name="message9" text="未连接硬件设备!" />
+	  <Control name="message10" text="与硬件设备已断开!" />
+	  <Control name="str1" text="关闭连接" />
+	  <Control name="str2" text="连接" />
+     </Controls>
+  </Form>
  <!-- OTSIncAReportApp -->
 <Form>
    <Name>frmReportApp</Name>

+ 15 - 6
OTSPartA_STDEditor/BaseClass/STDdata.cs

@@ -27,10 +27,10 @@ namespace OTSPartA_STDEditor
         bool b_IfElementAnalysis = true;
 
 
-        public string STDId
+        public int STDId
         {
-            set { s_STDId = value; }
-            get { return s_STDId; }
+            set { s_STDId = value.ToString(); }
+            get { return int.Parse(s_STDId); }
         }
 
         public string Hardness
@@ -111,10 +111,18 @@ namespace OTSPartA_STDEditor
             get { return s_Expression; }
         }
 
-        public string GroupId
+
+
+
+
+
+
+
+
+        public int GroupId
         {
-            set { s_GroupId = value; }
-            get { return s_GroupId; }
+            set { s_GroupId = value.ToString(); }
+            get { return int.Parse(s_GroupId); }
         }
 
         public string ListNum
@@ -152,6 +160,7 @@ namespace OTSPartA_STDEditor
         public object Clone(STDdata a_oSource)
         {
             STDdata MySTDdata = new STDdata();
+            MySTDdata.STDId = a_oSource.STDId;
             MySTDdata.Hardness = a_oSource.Hardness ;
             MySTDdata.Density = a_oSource.Density ;
             MySTDdata.Electrical_conductivity = a_oSource.Electrical_conductivity ;

+ 27 - 2
OTSPartA_STDEditor/UI/Attributes.cs

@@ -196,6 +196,7 @@ namespace OTSPartA_STDEditor
             Grid_Attributes[9, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
             Grid_Attributes[10, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
 
+            AddSTDGroupsToAttribute();
             Grid_Attributes.Selection.FocusStyle = SourceGrid.FocusStyle.None;
             //SourceGrid.Position po = new SourceGrid.Position(1, 0);
             //Grid_Attributes[1, 0].Grid.Select();
@@ -220,7 +221,7 @@ namespace OTSPartA_STDEditor
             Grid_Attributes[10, 1].Value = sTDdata.Element;
 
             //m_MainForm.AddSTDGroupsToAttribute();
-            Grid_Attributes[11, 1].Value = m_MainForm._sTDEditor.GroupIdDictionaryFromId[int.Parse(sTDdata.GroupId)];
+            Grid_Attributes[11, 1].Value = m_MainForm._sTDEditor.GroupIdDictionaryFromId[sTDdata.GroupId];
 
             //SourceGrid.Position po = new SourceGrid.Position(1, 0);
             //Grid_Attributes[1, 0].Grid.Select();
@@ -246,7 +247,7 @@ namespace OTSPartA_STDEditor
             Grid_Attributes[10, 1].Value = sTDdata.Element;
 
             //m_MainForm.AddSTDGroupsToAttribute();
-            Grid_Attributes[11, 1].Value = m_MainForm._sTDEditor.GroupIdDictionaryFromId[int.Parse(sTDdata.GroupId)];
+            Grid_Attributes[11, 1].Value = m_MainForm._sTDEditor.GroupIdDictionaryFromId[sTDdata.GroupId];
 
             //SourceGrid.Position po = new SourceGrid.Position(1, 0);
             //Grid_Attributes[1, 0].Grid.Select();
@@ -254,5 +255,29 @@ namespace OTSPartA_STDEditor
 
             Grid_Attributes.Refresh();
         }
+
+        public void AddSTDGroupsToAttribute()
+        {
+            List<string> ss = new List<string>();
+            foreach (var item in m_MainForm._sTDEditor.GroupDictionary)
+            {
+                ss.Add(item.Value.name.ToString());
+            }
+            SourceGrid.Cells.Editors.ComboBox GroupIdCBBox = new SourceGrid.Cells.Editors.ComboBox(typeof(string));
+            GroupIdCBBox.StandardValues = ss;
+            GroupIdCBBox.EditableMode = SourceGrid.EditableMode.SingleClick | SourceGrid.EditableMode.Focus;
+            Grid_Attributes[11, 1] = new SourceGrid.Cells.Cell("Default", GroupIdCBBox);
+            GroupIdCBBox.Control.DropDownStyle = ComboBoxStyle.DropDownList;        //设置下拉框为不可以编辑的状态
+            ComboBox winFormsCombo = GroupIdCBBox.Control;
+            winFormsCombo.SelectedValueChanged += (sender, e) =>
+            {
+                if(winFormsCombo.Text=="")
+                {
+                    return;
+                }
+                int Groupid = m_MainForm._sTDEditor.GroupIdDictionaryFromName[winFormsCombo.Text];
+                m_MainForm.m_STDRuleslist.AdjustTreenodeByGroup(Groupid);
+            };
+        }
     }
 }

+ 0 - 2
OTSPartA_STDEditor/UI/Form_GroupId.cs

@@ -74,9 +74,7 @@ namespace OTSPartA_STDEditor
                             }
                         }
                     }
-                    
                 }
-
                 m_dbConnection.Close();
                 return true;
             }

+ 66 - 75
OTSPartA_STDEditor/UI/Form_Main.cs

@@ -77,11 +77,21 @@ namespace OTSPartA_STDEditor
             m_SubMidWindow.ChangeText_textbox_STDEditor(STDId);
             m_Attributes.SetDatatoGrid_Attributes(STDId);
         }
+
+
         private void rbBackup_Click(object sender, EventArgs e)
         {
-            if (m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row >= 0)
+            if (m_STDRuleslist.tabControl1.SelectedIndex == 0)
             {
-                SaveDataOfSelRule(m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Column);
+                m_STDRuleslist.ConvertToRuleViewDic();
+            }
+            else
+            {
+                if (m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row > 0)
+                {
+                    STDdata sTDdata = (STDdata)m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Tag;
+                    SaveDataOfSelRule(sTDdata.STDId);
+                }
             }
             try
             {
@@ -99,6 +109,7 @@ namespace OTSPartA_STDEditor
                     }
                     FormForWaiting forWaiting = new FormForWaiting();
                     forWaiting.Show();
+                    this.Refresh();
                     System.IO.File.Copy(STDDBAddress, saveFile.FileName, true);
                     bool result = _sTDEditor.SaveAsDictionaryToClassify(saveFile.FileName);
                     if (result)
@@ -126,18 +137,26 @@ namespace OTSPartA_STDEditor
                 MessageBox.Show(ex.Message);
             }
         }
-        
-
         private void rbSave_Click(object sender, EventArgs e)
         {
-            if (m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row > 0)
+            if (m_STDRuleslist.tabControl1.SelectedIndex == 0)
             {
-                SaveDataOfSelRule(m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0);
+                m_STDRuleslist.ConvertToRuleViewDic();
+            }
+            else
+            {
+                if (m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row > 0)
+                {
+                    STDdata sTDdata = (STDdata)m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Tag;
+                    SaveDataOfSelRule(sTDdata.STDId);
+                }
             }
             if (Ruleformatcheck())
             {
                 FormForWaiting forWaiting = new FormForWaiting();
                 forWaiting.Show();
+
+                this.Refresh();
                 bool result = _sTDEditor.SaveDictionaryToClassify();
                 if (result)
                 {
@@ -157,22 +176,19 @@ namespace OTSPartA_STDEditor
                 return;
             }
         }
-
-
         bool Ruleformatcheck()
         {
             foreach (var ite in _sTDEditor.STDDictionary)
             {
                 if (CheckExpression(ite.Value.Expression))
                 {
-
                 }
                 else
                 {
                     int Id = 0;
                     for (int i = 1; i < m_STDRuleslist.Grid_Minerals.RowsCount; i++)
                     {
-                        if((int)m_STDRuleslist.Grid_Minerals[i, 0].Tag == ite.Key)
+                        if(((STDdata)m_STDRuleslist.Grid_Minerals[i, 0].Tag).STDId == ite.Key)
                         {
                             Id = i;break;
                         }
@@ -182,7 +198,7 @@ namespace OTSPartA_STDEditor
                     m_STDRuleslist.Grid_Minerals.Selection.Focus(pos, true);
                     m_STDRuleslist.Grid_Minerals.Refresh();
                     ChangeSTDEditorAndGrid_Attributes(ite.Key);
-                    m_STDRuleslist.PreRow = Convert.ToInt32(ite.Value.ListNum);
+                    m_STDRuleslist.Predata = ite.Value;
                     return false;
                 }
             }
@@ -407,44 +423,48 @@ namespace OTSPartA_STDEditor
         }
 
 
-        public void SaveDataOfSelRule(int PreRow, int PreColumn)
+
+
+
+
+        public void SaveDataOfSelRule(int stdid)
         {
-            _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].StrName = Convert.ToString(m_Attributes.Grid_Attributes[2, 1].Value);
-            _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Color = colorRGBtoHx16(m_Attributes.Grid_Attributes[3, 1].View.BackColor.R, m_Attributes.Grid_Attributes[3, 1].View.BackColor.G, m_Attributes.Grid_Attributes[3, 1].View.BackColor.B);
-            _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].IfElementAnalysis = Convert.ToBoolean(m_Attributes.Grid_Attributes[4, 1].Value);
-            _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Hardness = Convert.ToString(m_Attributes.Grid_Attributes[5, 1].Value);
-            _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Density = Convert.ToString(m_Attributes.Grid_Attributes[6, 1].Value);
-            _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Electrical_conductivity = Convert.ToString(m_Attributes.Grid_Attributes[7, 1].Value);
-            _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].BSE = Convert.ToString(m_Attributes.Grid_Attributes[8, 1].Value);
+            _sTDEditor.STDDictionary[stdid].StrName = Convert.ToString(m_Attributes.Grid_Attributes[2, 1].Value);
+            _sTDEditor.STDDictionary[stdid].Color = colorRGBtoHx16(m_Attributes.Grid_Attributes[3, 1].View.BackColor.R, m_Attributes.Grid_Attributes[3, 1].View.BackColor.G, m_Attributes.Grid_Attributes[3, 1].View.BackColor.B);
+            _sTDEditor.STDDictionary[stdid].IfElementAnalysis = Convert.ToBoolean(m_Attributes.Grid_Attributes[4, 1].Value);
+            _sTDEditor.STDDictionary[stdid].Hardness = Convert.ToString(m_Attributes.Grid_Attributes[5, 1].Value);
+            _sTDEditor.STDDictionary[stdid].Density = Convert.ToString(m_Attributes.Grid_Attributes[6, 1].Value);
+            _sTDEditor.STDDictionary[stdid].Electrical_conductivity = Convert.ToString(m_Attributes.Grid_Attributes[7, 1].Value);
+            _sTDEditor.STDDictionary[stdid].BSE = Convert.ToString(m_Attributes.Grid_Attributes[8, 1].Value);
 
 
             if (m_Attributes.Grid_Attributes[9, 1].Value != null)
             {
-                _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Formula = Convert.ToString(m_Attributes.Grid_Attributes[9, 1].Value);
+                _sTDEditor.STDDictionary[stdid].Formula = Convert.ToString(m_Attributes.Grid_Attributes[9, 1].Value);
             }
             else
             {
-                _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Formula = "";
+                _sTDEditor.STDDictionary[stdid].Formula = "";
             }
             if (m_Attributes.Grid_Attributes[10, 1].Value != null)
             {
-                _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Element = Convert.ToString(m_Attributes.Grid_Attributes[10, 1].Value);
+                _sTDEditor.STDDictionary[stdid].Element = Convert.ToString(m_Attributes.Grid_Attributes[10, 1].Value);
             }
             else
             {
-                _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Element = "";
+                _sTDEditor.STDDictionary[stdid].Element = "";
             }
 
             if (m_Attributes.Grid_Attributes[11, 1].Value != null)
             {
-                _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].GroupId = _sTDEditor.GroupIdDictionaryFromName[Convert.ToString(m_Attributes.Grid_Attributes[11, 1].Value)].ToString();
+                _sTDEditor.STDDictionary[stdid].GroupId = _sTDEditor.GroupIdDictionaryFromName[Convert.ToString(m_Attributes.Grid_Attributes[11, 1].Value)];
             }
             else
             {
-                _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].GroupId = "0";
+                _sTDEditor.STDDictionary[stdid].GroupId = -1;
             }
 
-            _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].Expression = m_SubMidWindow.m_STDEditor.textbox_STDEditor.Text.ToString();
+            _sTDEditor.STDDictionary[stdid].Expression = m_SubMidWindow.m_STDEditor.textbox_STDEditor.Text.ToString();
 
             string sKeyElements = "";
             for (int i = 0; i < m_SubMidWindow.m_STDEditor.dataGridView_KeyElements.Columns.Count; i++)
@@ -466,10 +486,10 @@ namespace OTSPartA_STDEditor
                 sSubElements = sSubElements.Substring(0, sSubElements.Length - 1);
             }
 
-            _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].KeyElementList = sKeyElements;
-            _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].SubElementList = sSubElements;
+            _sTDEditor.STDDictionary[stdid].KeyElementList = sKeyElements;
+            _sTDEditor.STDDictionary[stdid].SubElementList = sSubElements;
 
-            _sTDEditor.STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[PreRow, 0].Tag.ToString())].ListNum = PreRow.ToString();
+            _sTDEditor.STDDictionary[stdid].ListNum = "0";
         }
 
         public void RemoveSTDDictionaryItem(int STDId)
@@ -479,7 +499,7 @@ namespace OTSPartA_STDEditor
 
         public void ChangeStrName(int RowNum, string NewStrName)
         {
-            _sTDEditor.STDDictionary[(int)m_STDRuleslist.Grid_Minerals[RowNum, 0].Tag].StrName = NewStrName;
+            _sTDEditor.STDDictionary[((STDdata)m_STDRuleslist.Grid_Minerals[RowNum, 0].Tag).STDId].StrName = NewStrName;
             m_Attributes.Grid_Attributes[2, 1].Value = NewStrName;
         }
 
@@ -497,6 +517,9 @@ namespace OTSPartA_STDEditor
         public void SetNull()
         {
             m_SubMidWindow.m_STDEditor.textbox_STDEditor.Text = "";
+            SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
+            view.BackColor = Color.White;
+            m_Attributes.Grid_Attributes[3, 1].View = view;
             for (int i = 1; i < m_Attributes.Grid_Attributes.RowsCount - 1; i++)
             {
                 if (m_Attributes.Grid_Attributes[i, 1].Value != null)
@@ -512,10 +535,8 @@ namespace OTSPartA_STDEditor
                 }
             }
 
-            SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
-            view.BackColor = Color.White;
-            m_Attributes.Grid_Attributes[2, 1].View = view;
 
+            m_Attributes.Grid_Attributes.Refresh();
             m_SubMidWindow.m_STDEditor.dataGridView_KeyElements.Rows.Clear();
             m_SubMidWindow.m_STDEditor.dataGridView_KeyElements.Columns.Clear();
             m_SubMidWindow.m_STDEditor.dataGridView_SubElements.Rows.Clear();
@@ -553,38 +574,15 @@ namespace OTSPartA_STDEditor
                 }
             }
         }
-
-
-        public void AddSTDGroupsToAttribute()
-        {
-            List<string> ss = new List<string>();
-            foreach (var item in _sTDEditor.GroupDictionary)
-            {
-                ss.Add(item.Value.name.ToString());
-            }
-            SourceGrid.Cells.Editors.ComboBox GroupIdCBBox = new SourceGrid.Cells.Editors.ComboBox(typeof(string));
-            GroupIdCBBox.StandardValues = ss;
-            GroupIdCBBox.EditableMode = SourceGrid.EditableMode.SingleClick | SourceGrid.EditableMode.Focus;
-            m_Attributes.Grid_Attributes[11, 1] = new SourceGrid.Cells.Cell("Default", GroupIdCBBox);
-            GroupIdCBBox.Control.DropDownStyle = ComboBoxStyle.DropDownList;        //设置下拉框为不可以编辑的状态
-        }
-
-        void SetNonexistentGroupsToDefault()
-        {
-            _sTDEditor.SetNonexistentGroupsToDefault(); ;
-            m_Attributes.Grid_Attributes.Refresh();
-        }
-        
         private void ribbon_GroupNameMaintenance_Click(object sender, EventArgs e)
         {
-            //STDDictionary[int.Parse(m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Tag.ToString())].GroupId = GroupIdDictionaryFromName[m_Attributes.Grid_Attributes[10, 1].Value.ToString()].ToString();
             int selGroupId = _sTDEditor.GroupIdDictionaryFromName[m_Attributes.Grid_Attributes[11, 1].Value.ToString()];
             Form_GroupId form_GroupId = new Form_GroupId(STDDBAddress, this);
             DialogResult dialogResult = form_GroupId.ShowDialog();
             if (dialogResult == DialogResult.Yes)
             {
-                AddSTDGroupsToAttribute();
-                //SetNonexistentGroupsToDefault();
+
+                m_Attributes.AddSTDGroupsToAttribute();
                 m_Attributes.Grid_Attributes[11, 1].Value = _sTDEditor.GroupIdDictionaryFromId[selGroupId];
             }
         }
@@ -607,7 +605,11 @@ namespace OTSPartA_STDEditor
                         {
                             if ((m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Value.ToString().Replace(" ", "").Trim() != ""))
                             {
-                                SaveDataOfSelRule(m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0);
+                                if (m_STDRuleslist.Predata != null)
+                                {
+                                    int id = m_STDRuleslist.Predata.STDId;
+                                    SaveDataOfSelRule(id);
+                                }
                             }
                             else
                             {
@@ -681,7 +683,7 @@ namespace OTSPartA_STDEditor
             ribbon_ZeroRules.Enabled = true;
             ribbon_ESDMaxRules.Enabled = true;
             ribbon_UserConstants.Enabled = true;
-            ribbon_GroupNameMaintenance.Enabled = true;
+            ribbon_GroupNameMaintenance.Enabled = false;
         }
 
 
@@ -718,7 +720,6 @@ namespace OTSPartA_STDEditor
             m_SubMidWindow.Show(dockPanel1, DockState.Document);
             dockPanel1.DockLeftPortion = 360;
             dockPanel1.DockRightPortion = 381;
-            AddSTDGroupsToAttribute();
             m_SubMidWindow.m_STDEditor.comboBox_Constants.Items.Clear();
             if(_sTDEditor.ConstantsStr != null)
             { 
@@ -732,7 +733,7 @@ namespace OTSPartA_STDEditor
                 {
                     m_STDRuleslist.button_DownOrder.Enabled = false;
                 }
-                ChangeSTDEditorAndGrid_Attributes(int.Parse(m_STDRuleslist.Grid_Minerals[1, 0].Tag.ToString()));
+                ChangeSTDEditorAndGrid_Attributes(((STDdata)m_STDRuleslist.Grid_Minerals[1, 0].Tag).STDId);
                 Position pos = new Position(1, 0);
                 m_STDRuleslist.Grid_Minerals[1, 0].Grid.Select();
                 m_STDRuleslist.Grid_Minerals.Selection.Focus(pos, true);
@@ -762,7 +763,8 @@ namespace OTSPartA_STDEditor
                         {
                             if (m_STDRuleslist.Grid_Minerals[m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0].Value.ToString().Replace(" ", "").Trim() != "")
                             {
-                                SaveDataOfSelRule(m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row, 0);
+                                int id = m_STDRuleslist.Predata.STDId;
+                                SaveDataOfSelRule(id);
                             }
                             else
                             {
@@ -788,18 +790,6 @@ namespace OTSPartA_STDEditor
                             MessageBox.Show("Save failed!", "Tip");
                         }
                     }
-                    else
-                    {
-                        foreach (KeyValuePair<int, STDdata> kv in _sTDEditor.STDDictionary)
-                        {
-                            if (!_sTDEditor.GroupIdDictionaryFromId.Keys.Contains(int.Parse(kv.Value.GroupId)))
-                            {
-                                MessageBox.Show("There is non-existent grouping informations in the classification, please adjust!");
-                                e.Cancel = true;
-                                return;
-                            }
-                        }
-                    }
                 }
             }
         }
@@ -807,6 +797,7 @@ namespace OTSPartA_STDEditor
         {
             return _sTDEditor.EqualsBetweenDictionary();
         }
+
         private void rbNew_Click(object sender, EventArgs e)
         {
             SaveFileDialog saveFile = new SaveFileDialog();

+ 58 - 49
OTSPartA_STDEditor/UI/ReferenceLibrary.cs

@@ -122,7 +122,7 @@ namespace OTSPartA_STDEditor
                         foreach (DataRow item in dt.Rows)
                         {
                             STDdata new_STDdata = new STDdata();
-
+                            new_STDdata.STDId = (int)item["STDId"];
                             new_STDdata.Hardness = item["Hardness"].ToString();
                             new_STDdata.Density = item["Density"].ToString();
                             new_STDdata.Electrical_conductivity = item["Electrical_conductivity"].ToString();
@@ -134,7 +134,7 @@ namespace OTSPartA_STDEditor
                             new_STDdata.Color = item["Color"].ToString();
                             new_STDdata.KeyElementList = item["KeyElementList"].ToString();
                             new_STDdata.SubElementList = item["SubElementList"].ToString();
-                            new_STDdata.GroupId = item["GroupId"].ToString();
+                            new_STDdata.GroupId = (int)item["GroupId"];
 
                             STDDictionary.Add(int.Parse(item["STDId"].ToString()), new_STDdata);
                         }
@@ -190,10 +190,10 @@ namespace OTSPartA_STDEditor
                 }
 
                 PropGrid.Rows[i].Height = 25;
-                PropGrid.Rows[i].Tag = kv.Key;
+                PropGrid.Rows[i].Tag = kv.Value;
 
                 PropGrid[i, 1] = new SourceGrid.Cells.Cell(kv.Value.StrName, typeof(string));
-                PropGrid[i, 1].Tag = kv.Key;
+                PropGrid[i, 1].Tag = kv.Value;
 
                 PropGrid[i, 2] = new SourceGrid.Cells.Cell("", typeof(string));
 
@@ -208,7 +208,7 @@ namespace OTSPartA_STDEditor
                 PropGrid[i, 8] = new SourceGrid.Cells.Cell(kv.Value.BSE, typeof(string));
                 PropGrid[i, 9] = new SourceGrid.Cells.Cell(kv.Value.Formula, typeof(string));
                 PropGrid[i, 10] = new SourceGrid.Cells.Cell(kv.Value.Element, typeof(string));
-                PropGrid[i, 11] = new SourceGrid.Cells.Cell(ReferenceGroup[int.Parse(kv.Value.GroupId)], typeof(string));
+                PropGrid[i, 11] = new SourceGrid.Cells.Cell(ReferenceGroup[kv.Value.GroupId], typeof(string));
                 i++;
             }
 
@@ -336,7 +336,7 @@ namespace OTSPartA_STDEditor
 
                     // 判断左侧区域是否已经选中了某个stdmineral
                     bool bEnable = false;
-                    bEnable = (-1 == m_SubMidWindow.m_MainForm.m_STDRuleslist.PreRow) ? false : true;
+                    bEnable = (null == m_SubMidWindow.m_MainForm.m_STDRuleslist.Predata) ? false : true;
                     this.insertToolStripMenuItem.Enabled = bEnable;
                 }
             }
@@ -348,6 +348,11 @@ namespace OTSPartA_STDEditor
 
         private void insertToolStripMenuItem_Click(object sender, EventArgs e)
         {
+            if (m_SubMidWindow.m_MainForm.m_STDRuleslist.tabControl1.SelectedIndex == 0)
+            {
+                MessageBox.Show("Please do not operate the reference library in the grouping interface!");
+                return;
+            }
             m_SubMidWindow.m_MainForm.m_STDRuleslist.Grid_Minerals.Focus(true);
             int i = m_SubMidWindow.m_MainForm.m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row;
             int j = m_SubMidWindow.m_MainForm.m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Column;
@@ -357,43 +362,42 @@ namespace OTSPartA_STDEditor
                 //规则名称不为空
                 if (m_SubMidWindow.m_MainForm.m_STDRuleslist.Grid_Minerals[i, 0].Value.ToString().Replace(" ", "").Trim() != "")
                 {
-                    
-                            m_SubMidWindow.m_MainForm.SaveDataOfSelRule(i, j);
-
-                            PropGrid.Focus(true);
-                            int selrow = PropGrid.Selection.ActivePosition.Row;
-                            int STDnum = (int)PropGrid[selrow, 1].Tag;
-                            int STDId = 1;
-                            foreach (KeyValuePair<int, STDdata> kv in m_SubMidWindow.m_MainForm._sTDEditor.STDDictionary)
-                            {
-                                if (STDId < kv.Key)
-                                {
-                                    STDId = kv.Key;
-                                }
-                            }
-                            STDdata sT = new STDdata();
-                            sT.BSE = ReferenceDictionary[STDnum].BSE;
-                            sT.StrName = ReferenceDictionary[STDnum].StrName;
-                            sT.Color = ReferenceDictionary[STDnum].Color;
-                            sT.Density = ReferenceDictionary[STDnum].Density;
-                            sT.Expression = ReferenceDictionary[STDnum].Expression;
-                            sT.Formula = ReferenceDictionary[STDnum].Formula;
-                            sT.Hardness = ReferenceDictionary[STDnum].Hardness;
-                            sT.UsingImgPropertyList = ReferenceDictionary[STDnum].UsingImgPropertyList;
-                            sT.UsingOtherPropertyList = ReferenceDictionary[STDnum].UsingOtherPropertyList;
-                            sT.KeyElementList = ReferenceDictionary[STDnum].KeyElementList;
-                            sT.SubElementList = ReferenceDictionary[STDnum].SubElementList;
-                            sT.Electrical_conductivity = ReferenceDictionary[STDnum].Electrical_conductivity;
-                            sT.Element = ReferenceDictionary[STDnum].Element;
-                            sT.GroupId = ReferenceDictionary[STDnum].GroupId;
-                            m_SubMidWindow.m_MainForm._sTDEditor.STDDictionary.Add(STDId + 1, sT);
-                            
-                            m_SubMidWindow.m_MainForm.m_STDRuleslist.InsertNewRow(STDId + 1, sT.StrName, STDRuleslist.colorHx16toRGB(sT.Color));
-                            m_SubMidWindow.m_MainForm.m_STDRuleslist.Refresh();
-
-                            m_SubMidWindow.m_MainForm.m_STDRuleslist.PreRow = i;
-                       
-
+                    int id = ((STDdata)m_SubMidWindow.m_MainForm.m_STDRuleslist.Grid_Minerals[i, 0].Tag).STDId;
+                    m_SubMidWindow.m_MainForm.SaveDataOfSelRule(id);
+
+                    PropGrid.Focus(true);
+                    int selrow = PropGrid.Selection.ActivePosition.Row;
+                    int STDnum = ((STDdata)PropGrid[selrow, 1].Tag).STDId;
+                    int STDId = 1;
+                    foreach (KeyValuePair<int, STDdata> kv in m_SubMidWindow.m_MainForm._sTDEditor.STDDictionary)
+                    {
+                        if (STDId < kv.Key)
+                        {
+                            STDId = kv.Key;
+                        }
+                    }
+                    STDdata sT = new STDdata();
+                    sT.BSE = ReferenceDictionary[STDnum].BSE;
+                    sT.StrName = ReferenceDictionary[STDnum].StrName;
+                    sT.Color = ReferenceDictionary[STDnum].Color;
+                    sT.Density = ReferenceDictionary[STDnum].Density;
+                    sT.Expression = ReferenceDictionary[STDnum].Expression;
+                    sT.Formula = ReferenceDictionary[STDnum].Formula;
+                    sT.Hardness = ReferenceDictionary[STDnum].Hardness;
+                    sT.UsingImgPropertyList = ReferenceDictionary[STDnum].UsingImgPropertyList;
+                    sT.UsingOtherPropertyList = ReferenceDictionary[STDnum].UsingOtherPropertyList;
+                    sT.KeyElementList = ReferenceDictionary[STDnum].KeyElementList;
+                    sT.SubElementList = ReferenceDictionary[STDnum].SubElementList;
+                    sT.Electrical_conductivity = ReferenceDictionary[STDnum].Electrical_conductivity;
+                    sT.Element = ReferenceDictionary[STDnum].Element;
+                    sT.GroupId = ReferenceDictionary[STDnum].GroupId;
+                    sT.STDId = STDnum;
+                    m_SubMidWindow.m_MainForm._sTDEditor.STDDictionary.Add(STDId + 1, sT);
+
+                    m_SubMidWindow.m_MainForm.m_STDRuleslist.InsertNewRow(STDId + 1, sT.StrName, STDRuleslist.colorHx16toRGB(sT.Color));
+                    m_SubMidWindow.m_MainForm.m_STDRuleslist.Refresh();
+
+                    m_SubMidWindow.m_MainForm.m_STDRuleslist.Predata = (STDdata)m_SubMidWindow.m_MainForm.m_STDRuleslist.Grid_Minerals[i, 0].Tag;
                 }
 
             }
@@ -420,6 +424,11 @@ namespace OTSPartA_STDEditor
 
         private void addIntoMainLabToolStripMenuItem_Click(object sender, EventArgs e)
         {
+            if (m_SubMidWindow.m_MainForm.m_STDRuleslist.tabControl1.SelectedIndex == 0)
+            {
+                MessageBox.Show("Please do not operate the reference library in the grouping interface!");
+                return;
+            }
             m_SubMidWindow.m_MainForm.m_STDRuleslist.Grid_Minerals.Focus(true);
             int i = m_SubMidWindow.m_MainForm.m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Row;
             int j = m_SubMidWindow.m_MainForm.m_STDRuleslist.Grid_Minerals.Selection.ActivePosition.Column;
@@ -429,8 +438,8 @@ namespace OTSPartA_STDEditor
                 //规则名称不为空
                 if (m_SubMidWindow.m_MainForm.m_STDRuleslist.Grid_Minerals[i, j].Value.ToString().Replace(" ", "").Trim() != "")
                 {
-
-                    m_SubMidWindow.m_MainForm.SaveDataOfSelRule(i, j);
+                    int id = ((STDdata)m_SubMidWindow.m_MainForm.m_STDRuleslist.Grid_Minerals[i, 0].Tag).STDId; ;
+                    m_SubMidWindow.m_MainForm.SaveDataOfSelRule(id);
 
                     AddIntoMainLab();
                 }
@@ -440,12 +449,11 @@ namespace OTSPartA_STDEditor
                 AddIntoMainLab();
             }
         }
-
         void AddIntoMainLab()
         {
             PropGrid.Focus(true);
             int selrow = PropGrid.Selection.ActivePosition.Row;
-            int STDnum = (int)PropGrid[selrow, 1].Tag;
+            int STDnum = ((STDdata)PropGrid[selrow, 1].Tag).STDId;
 
             int STDId = 1;
             foreach (KeyValuePair<int, STDdata> kv in m_SubMidWindow.m_MainForm._sTDEditor.STDDictionary)
@@ -456,6 +464,7 @@ namespace OTSPartA_STDEditor
                 }
             }
             STDdata sT = new STDdata();
+            sT.STDId = STDId + 1;
             sT.BSE = ReferenceDictionary[STDnum].BSE;
             sT.StrName = ReferenceDictionary[STDnum].StrName;
             sT.Color = ReferenceDictionary[STDnum].Color;
@@ -469,7 +478,7 @@ namespace OTSPartA_STDEditor
             sT.SubElementList = ReferenceDictionary[STDnum].SubElementList;
             sT.Electrical_conductivity = ReferenceDictionary[STDnum].Electrical_conductivity;
             sT.Element = ReferenceDictionary[STDnum].Element;
-            if (m_SubMidWindow.m_MainForm._sTDEditor.GroupIdDictionaryFromId.ContainsKey(int.Parse(ReferenceDictionary[STDnum].GroupId)))
+            if (m_SubMidWindow.m_MainForm._sTDEditor.GroupIdDictionaryFromId.ContainsKey(ReferenceDictionary[STDnum].GroupId))
             { sT.GroupId = ReferenceDictionary[STDnum].GroupId; }
             else
             {
@@ -480,7 +489,7 @@ namespace OTSPartA_STDEditor
 
             m_SubMidWindow.m_MainForm.m_STDRuleslist.AddNewRow(STDId + 1, sT.StrName, STDRuleslist.colorHx16toRGB(sT.Color));
             m_SubMidWindow.m_MainForm.m_STDRuleslist.Refresh();
-            m_SubMidWindow.m_MainForm.m_STDRuleslist.PreRow = m_SubMidWindow.m_MainForm.m_STDRuleslist.Grid_Minerals.RowsCount - 1;
+            m_SubMidWindow.m_MainForm.m_STDRuleslist.Predata = (STDdata)m_SubMidWindow.m_MainForm.m_STDRuleslist.Grid_Minerals[m_SubMidWindow.m_MainForm.m_STDRuleslist.Grid_Minerals.RowsCount - 1, 0].Tag;
         }
     }
 }

+ 50 - 3
OTSPartA_STDEditor/UI/STDRuleslist.Designer.cs

@@ -35,6 +35,10 @@
             this.tabControl1 = new System.Windows.Forms.TabControl();
             this.tabPage_GroupView = new System.Windows.Forms.TabPage();
             this.treeView_G = new System.Windows.Forms.TreeView();
+            this.contextMenuStrip_GroupView = new System.Windows.Forms.ContextMenuStrip(this.components);
+            this.ToolStripMenuItem_NewGroup = new System.Windows.Forms.ToolStripMenuItem();
+            this.ToolStripMenuItem_DelGroup = new System.Windows.Forms.ToolStripMenuItem();
+            this.ToolStripMenuItem_EDGcolor = new System.Windows.Forms.ToolStripMenuItem();
             this.tabPage_RuleView = new System.Windows.Forms.TabPage();
             this.Grid_Minerals = new SourceGrid.Grid();
             this.button_DownOrder = new System.Windows.Forms.Button();
@@ -42,6 +46,7 @@
             this.MenuStrip_STDRulelist.SuspendLayout();
             this.tabControl1.SuspendLayout();
             this.tabPage_GroupView.SuspendLayout();
+            this.contextMenuStrip_GroupView.SuspendLayout();
             this.tabPage_RuleView.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -52,8 +57,7 @@
             this.ToolStripMenuItem_New,
             this.ToolStripMenuItem_Del});
             this.MenuStrip_STDRulelist.Name = "MenuStrip_STDRulelist";
-            this.MenuStrip_STDRulelist.Size = new System.Drawing.Size(101, 48);
-            this.MenuStrip_STDRulelist.Resize += new System.EventHandler(this.MenuStrip_STDRulelist_Resize);
+            this.MenuStrip_STDRulelist.Size = new System.Drawing.Size(101, 50);
             // 
             // ToolStripMenuItem_New
             // 
@@ -97,11 +101,47 @@
             // 
             // treeView_G
             // 
+            this.treeView_G.AllowDrop = true;
+            this.treeView_G.ContextMenuStrip = this.contextMenuStrip_GroupView;
             this.treeView_G.Dock = System.Windows.Forms.DockStyle.Fill;
             this.treeView_G.Location = new System.Drawing.Point(3, 3);
             this.treeView_G.Name = "treeView_G";
             this.treeView_G.Size = new System.Drawing.Size(299, 750);
             this.treeView_G.TabIndex = 0;
+            this.treeView_G.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeView_G_ItemDrag);
+            this.treeView_G.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView_G_NodeMouseClick);
+            this.treeView_G.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_G_DragDrop);
+            this.treeView_G.DragOver += new System.Windows.Forms.DragEventHandler(this.treeView_G_DragOver);
+            // 
+            // contextMenuStrip_GroupView
+            // 
+            this.contextMenuStrip_GroupView.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.ToolStripMenuItem_NewGroup,
+            this.ToolStripMenuItem_DelGroup,
+            this.ToolStripMenuItem_EDGcolor});
+            this.contextMenuStrip_GroupView.Name = "contextMenuStrip_GroupView";
+            this.contextMenuStrip_GroupView.Size = new System.Drawing.Size(137, 70);
+            // 
+            // ToolStripMenuItem_NewGroup
+            // 
+            this.ToolStripMenuItem_NewGroup.Name = "ToolStripMenuItem_NewGroup";
+            this.ToolStripMenuItem_NewGroup.Size = new System.Drawing.Size(136, 22);
+            this.ToolStripMenuItem_NewGroup.Text = "新建组";
+            this.ToolStripMenuItem_NewGroup.Click += new System.EventHandler(this.ToolStripMenuItem_NewGroup_Click);
+            // 
+            // ToolStripMenuItem_DelGroup
+            // 
+            this.ToolStripMenuItem_DelGroup.Name = "ToolStripMenuItem_DelGroup";
+            this.ToolStripMenuItem_DelGroup.Size = new System.Drawing.Size(136, 22);
+            this.ToolStripMenuItem_DelGroup.Text = "删除组";
+            this.ToolStripMenuItem_DelGroup.Click += new System.EventHandler(this.ToolStripMenuItem_DelGroup_Click);
+            // 
+            // ToolStripMenuItem_EDGcolor
+            // 
+            this.ToolStripMenuItem_EDGcolor.Name = "ToolStripMenuItem_EDGcolor";
+            this.ToolStripMenuItem_EDGcolor.Size = new System.Drawing.Size(136, 22);
+            this.ToolStripMenuItem_EDGcolor.Text = "修改组颜色";
+            this.ToolStripMenuItem_EDGcolor.Click += new System.EventHandler(this.ToolStripMenuItem_EdGroupColor_Click);
             // 
             // tabPage_RuleView
             // 
@@ -144,6 +184,7 @@
             this.button_DownOrder.TabIndex = 32;
             this.button_DownOrder.Text = "↓";
             this.button_DownOrder.UseVisualStyleBackColor = true;
+            this.button_DownOrder.Visible = false;
             this.button_DownOrder.Click += new System.EventHandler(this.button_DownOrder_Click);
             // 
             // button_UpOrder
@@ -155,6 +196,7 @@
             this.button_UpOrder.TabIndex = 31;
             this.button_UpOrder.Text = "↑";
             this.button_UpOrder.UseVisualStyleBackColor = true;
+            this.button_UpOrder.Visible = false;
             this.button_UpOrder.Click += new System.EventHandler(this.button_UpOrder_Click);
             // 
             // STDRuleslist
@@ -176,6 +218,7 @@
             this.MenuStrip_STDRulelist.ResumeLayout(false);
             this.tabControl1.ResumeLayout(false);
             this.tabPage_GroupView.ResumeLayout(false);
+            this.contextMenuStrip_GroupView.ResumeLayout(false);
             this.tabPage_RuleView.ResumeLayout(false);
             this.ResumeLayout(false);
 
@@ -185,12 +228,16 @@
         private System.Windows.Forms.ContextMenuStrip MenuStrip_STDRulelist;
         private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_New;
         private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_Del;
-        private System.Windows.Forms.TabControl tabControl1;
         private System.Windows.Forms.TabPage tabPage_GroupView;
         private System.Windows.Forms.TabPage tabPage_RuleView;
         public System.Windows.Forms.Button button_DownOrder;
         public System.Windows.Forms.Button button_UpOrder;
         private System.Windows.Forms.TreeView treeView_G;
         public SourceGrid.Grid Grid_Minerals;
+        private System.Windows.Forms.ContextMenuStrip contextMenuStrip_GroupView;
+        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_NewGroup;
+        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_DelGroup;
+        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_EDGcolor;
+        public System.Windows.Forms.TabControl tabControl1;
     }
 }

+ 490 - 297
OTSPartA_STDEditor/UI/STDRuleslist.cs

@@ -2,20 +2,17 @@
 using SourceGrid;
 using System;
 using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
 using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Drawing.Imaging;
+using System.Runtime.InteropServices;
+
 using System.Windows.Forms;
-using static System.Windows.Forms.VisualStyles.VisualStyleElement;
 
 namespace OTSPartA_STDEditor
 {
     public partial class STDRuleslist : DockContent
     {
-        public int PreRow = 1;//之前选中的位置
+        public STDdata Predata = null;//之前选中的位置
         public Form_Main m_MainForm = null;
         ValueChangedEvent m_ValueChangedEvent = null;//单元格内容改变事件
         Dictionary<int,STDGroups> GroupViewDic=null;
@@ -26,75 +23,16 @@ namespace OTSPartA_STDEditor
             m_ValueChangedEvent = new ValueChangedEvent(this);
         }
         System.Collections.Hashtable table_STDRuleslist;
-
         private void STDRuleslist_Load(object sender, EventArgs e)
         {
             m_MainForm.lan = new Language(this);
             table_STDRuleslist = m_MainForm.lan.GetNameTable("Attributes");
-            Grid_Minerals.Redim(m_MainForm._sTDEditor.STDDictionary.Count + 1, 2);
-            SourceGrid.Cells.ColumnHeader head1 = null;
-            if (m_MainForm.lan.GetNameTable("Form_Main")["language"].ToString() == "EN")
-            {
-                head1 = new SourceGrid.Cells.ColumnHeader("Rule Name");
-            }
-            else
-            {
-                head1 = new SourceGrid.Cells.ColumnHeader("规则名称");
-            }
-            Grid_Minerals[0, 0] = head1;
-
-            SourceGrid.Cells.ColumnHeader head2 = null;
-            if (m_MainForm.lan.GetNameTable("Form_Main")["language"].ToString() == "EN")
-            {
-                head2 = new SourceGrid.Cells.ColumnHeader("Color");
-            }
-            else
-            {
-                head2 = new SourceGrid.Cells.ColumnHeader("颜色");
-            }
-            Grid_Minerals[0, 1] = head2;
-
-            SourceGrid.Cells.Views.ColumnHeader boldHeader = new SourceGrid.Cells.Views.ColumnHeader();
-            boldHeader.Font = new Font("Microsoft YaHei UI", 11, FontStyle.Bold);
-            boldHeader.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
-            Grid_Minerals[0, 0].View = boldHeader;
-            Grid_Minerals[0, 1].View = boldHeader;
-            Grid_Minerals.Rows.SetHeight(0, 25);
-
-            head1.AutomaticSortEnabled = false;
-            head2.AutomaticSortEnabled = false;
-
-            Grid_Minerals.Selection.EnableMultiSelection = false;
-            Grid_Minerals.AutoStretchColumnsToFitWidth = true;
-            Grid_Minerals.Columns[0].Width = this.Width/2-10;
-            Grid_Minerals.Columns[1].Width = this.Width/2-20;
-
-
-            int i = 1;
-            foreach (KeyValuePair<int, STDdata> kv in m_MainForm._sTDEditor.STDDictionary)
-            {
-                Grid_Minerals[i, 0] = new SourceGrid.Cells.Cell(kv.Value.StrName, typeof(string));
-                Grid_Minerals.Rows[i].Height = 25;
-                Grid_Minerals[i, 0].Tag = kv.Key;
-
-
-                Grid_Minerals[i, 1] = new SourceGrid.Cells.Cell();
-                SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
-                view.BackColor = colorHx16toRGB(kv.Value.Color);
-                Grid_Minerals[i, 1].View = view;
-                i++;
-            }
-
-
-
-            Grid_Minerals.Controller.AddController(m_ValueChangedEvent);
-            Grid_Minerals.FixedRows = 1;// 第一行是列标题不可以滚动
-            Grid_Minerals.Selection.FocusStyle = FocusStyle.None;
-
-
+            InitRuleView();
             button_UpOrder.Enabled = false;
             button_DownOrder.Enabled = false;
         }
+
+
         /// <summary>
         /// [颜色:16进制转成RGB]
         /// </summary>
@@ -125,67 +63,44 @@ namespace OTSPartA_STDEditor
             ls_gd.Focus();
             int i = ls_gd.Selection.ActivePosition.Row;
             int j = ls_gd.Selection.ActivePosition.Column;
-            //string jj =m_MainForm.m_Attributes.Grid_Attributes[10, 1].Value.ToString();
-            /// 保证鼠标点击的GRID行和列是有效的
             if (i >= 0 && j >= 0)
             {
-                ////规则名称不为空
-                //if (Grid_Minerals[i, 0].Value.ToString().Replace(" ", "").Trim() != "")
-                //{
-                //    if (m_MainForm.CheckAttributes() && m_MainForm.Checktextbox_STDEditor())
-                //    {
-
-                m_MainForm.SaveDataOfSelRule(PreRow, 0);
-                m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(Grid_Minerals[i, 0].Tag.ToString()));
+                if (Predata != null)
+                {
+                    m_MainForm.SaveDataOfSelRule(Predata.STDId);
+                }
+                m_MainForm.ChangeSTDEditorAndGrid_Attributes(((STDdata)Grid_Minerals[i, 0].Tag).STDId);
                 m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
-                PreRow = i;
-
-                //    }
-                //    else
-                //    {
-                //        Position pos = new Position(PreRow, 0);
-                //        Grid_Minerals.Selection.Focus(pos, true);
-                //        m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
-                //    }
-                //}
-                //else
-                //{
-                //    Position pos = new Position(PreRow, 0);
-                //    Grid_Minerals.Selection.Focus(pos, true);
-                //    m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
-                //}
+                Predata = (STDdata)Grid_Minerals[i, 0].Tag;
             }
-
             SetOrderButtonsStatus();
         }
-        /// <summary>
-        /// 新建
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
         private void ToolStripMenuItem_New_Click(object sender, EventArgs e)
         {
             int i = Grid_Minerals.Selection.ActivePosition.Row;
             int j = Grid_Minerals.Selection.ActivePosition.Column;
-
-            /// 保证鼠标点击的GRID行和列是有效的
             if (i >= 0 && j >= 0)
             {
-                ////规则名称不为空
-                //if (Grid_Minerals[i, j].Value.ToString().Replace(" ", "").Trim() != "")
-                //{
-                //    if (m_MainForm.CheckAttributes())
-                //    {
-                //        if (m_MainForm.Checktextbox_STDEditor())
-                //        {
-                            m_MainForm.SaveDataOfSelRule(i, j);
-
-                            int STDId = m_MainForm._sTDEditor.AddSTDDictionaryItem();
-                            AddNewRow(STDId, "NewRuleName", Attributes.colorHx16toRGB(m_MainForm._sTDEditor.STDDictionary[STDId].Color));
-                            m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
-                //        }
-                //    }
-                //}
+                int id = ((STDdata)Grid_Minerals[i, 0].Tag).STDId;
+                m_MainForm.SaveDataOfSelRule(id);
+                Predata = (STDdata)Grid_Minerals[i, 0].Tag;
+                int STDId = m_MainForm._sTDEditor.AddSTDDictionaryItem();
+                AddNewRow(STDId, "NewRuleName", Attributes.colorHx16toRGB(m_MainForm._sTDEditor.STDDictionary[STDId].Color));
+                m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
             }
             else
             {
@@ -193,38 +108,30 @@ namespace OTSPartA_STDEditor
                 AddNewRow(STDId, "NewRuleName", Attributes.colorHx16toRGB(m_MainForm._sTDEditor.STDDictionary[STDId].Color));
                 m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
             }
-            //SetOrderButtonsStatus();
         }
-
         public void AddNewRow(int STDId, string RuleName, Color color)
         {
             Grid_Minerals.Rows.Insert(Grid_Minerals.Rows.Count);
             Grid_Minerals[Grid_Minerals.Rows.Count - 1, 0] = new SourceGrid.Cells.Cell(RuleName, typeof(string));
-            Grid_Minerals[Grid_Minerals.Rows.Count - 1, 0].Tag = STDId;
+            Grid_Minerals[Grid_Minerals.Rows.Count - 1, 0].Tag = m_MainForm._sTDEditor.STDDictionary[STDId];
             Grid_Minerals.Rows[Grid_Minerals.Rows.Count - 1].Height = 25;
-
             Grid_Minerals[Grid_Minerals.Rows.Count - 1, 1] = new SourceGrid.Cells.Cell();
-            //Grid_Minerals[Grid_Minerals.Rows.Count - 1, 1].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
             m_MainForm._sTDEditor.STDDictionary[STDId].StrName = RuleName;
             m_MainForm.ChangeSTDEditorAndGrid_Attributes(STDId);
-
             SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
             view.BackColor = color;
             Grid_Minerals[Grid_Minerals.Rows.Count - 1, 1].View = view;
-
             Position pos = new Position(Grid_Minerals.Rows.Count - 1, 0);
             Grid_Minerals.Selection.Focus(pos, true);
-
-            PreRow = Grid_Minerals.Rows.Count - 1;
+            Predata = (STDdata)Grid_Minerals[Grid_Minerals.Rows.Count - 1, 0].Tag;
             SetOrderButtonsStatus();
         }
-
         void Grid_MineralsDelRow()
         {
             int x = Grid_Minerals.Selection.ActivePosition.Row;
             if (x > 0)
             {
-                m_MainForm.RemoveSTDDictionaryItem((int)Grid_Minerals[x, 0].Tag);
+                m_MainForm.RemoveSTDDictionaryItem(((STDdata)Grid_Minerals[x, 0].Tag).STDId);
                 Grid_Minerals.Rows.Remove(x);
                 if (Grid_Minerals.RowsCount > 1)
                 {
@@ -233,9 +140,8 @@ namespace OTSPartA_STDEditor
                         Position pos = new Position(x, 0);
                         Grid_Minerals.Selection.Focus(pos, true);
                         Grid_Minerals[x, 0].Grid.Select();
-
-                        m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(Grid_Minerals[x, 0].Tag.ToString()));
-                        PreRow = x;
+                        m_MainForm.ChangeSTDEditorAndGrid_Attributes(((STDdata)Grid_Minerals[x, 0].Tag).STDId);
+                        Predata = (STDdata)Grid_Minerals[x, 0].Tag;
                     }
                     else
                     {
@@ -243,26 +149,45 @@ namespace OTSPartA_STDEditor
                         Grid_Minerals.Selection.Focus(pos, true);
                         Grid_Minerals[x - 1, 0].Grid.Select();
 
-                        m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(Grid_Minerals[x - 1, 0].Tag.ToString()));
-                        PreRow = x - 1;
+                        m_MainForm.ChangeSTDEditorAndGrid_Attributes(((STDdata)Grid_Minerals[x-1, 0].Tag).STDId);
+                        Predata = (STDdata)Grid_Minerals[x-1, 0].Tag;
                     }
                 }
                 else
                 {
                     m_MainForm.SetNull();
-                    PreRow = -1;
+                    Predata = null;
                 }
             }
             else
             {
                 MessageBox.Show("There is no rule to delete!", "Tip");
             }
-            SetOrderButtonsStatus();
         }
         private void ToolStripMenuItem_Del_Click(object sender, EventArgs e)
         {
             Grid_MineralsDelRow();
         }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
         public class ValueChangedEvent : SourceGrid.Cells.Controllers.ControllerBase
         {
@@ -285,12 +210,10 @@ namespace OTSPartA_STDEditor
                 }
             }
         }
-
         public void ChangeStrName(int RowNum, string NewStrName)
         {
             m_MainForm.ChangeStrName(RowNum, NewStrName);
         }
-
         private void Grid_Minerals_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
         {
             SourceGrid.Grid ls_gd = (SourceGrid.Grid)sender;
@@ -303,27 +226,26 @@ namespace OTSPartA_STDEditor
             }
             if (e.KeyCode == Keys.Up)
             {
-                /// 保证鼠标点击的GRID行和列是有效的
                 if (i >= 2 && j >= 0)
                 {
                     //规则名称不为空
                     if (Grid_Minerals[i, 0].Value.ToString().Replace(" ", "").Trim() != "")
                     {
-                        
+                        int id = ((STDdata)Grid_Minerals[i, 0].Tag).STDId;
+
+                        m_MainForm.SaveDataOfSelRule(id);
+                        m_MainForm.ChangeSTDEditorAndGrid_Attributes(((STDdata)Grid_Minerals[i - 1, 0].Tag).STDId);
+                        m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
+                        Predata = (STDdata)Grid_Minerals[i - 1, 0].Tag;
+                        if (i == 2)
+                        {
+                            button_UpOrder.Enabled = false;
+                        }
+                        if (i == ls_gd.RowsCount - 1)
+                        {
+                            button_DownOrder.Enabled = true;
+                        }
 
-                            m_MainForm.SaveDataOfSelRule(i, 0);
-                            m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(Grid_Minerals[i - 1, 0].Tag.ToString()));
-                            m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
-                            PreRow = i;
-                            if (i == 2)
-                            {
-                                button_UpOrder.Enabled = false;
-                            }
-                            if (i == ls_gd.RowsCount - 1)
-                            {
-                                button_DownOrder.Enabled = true;
-                            }
-                        
                     }
                     else
                     {
@@ -335,17 +257,15 @@ namespace OTSPartA_STDEditor
             }
             if (e.KeyCode == Keys.Down)
             {
-                
                 if (i < ls_gd.RowsCount - 1 && j >= 0)
                 {
-                    //规则名称不为空
                     if (Grid_Minerals[i, 0].Value.ToString().Replace(" ", "").Trim() != "")
                     {
-                        
+                        int id = ((STDdata)Grid_Minerals[i, 0].Tag).STDId;
                            
-                                m_MainForm.SaveDataOfSelRule(i, 0);
-                                m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(Grid_Minerals[i + 1, 0].Tag.ToString()));
-                                PreRow = i;
+                                m_MainForm.SaveDataOfSelRule(id);
+                                m_MainForm.ChangeSTDEditorAndGrid_Attributes(((STDdata)Grid_Minerals[i + 1, 0].Tag).STDId);
+                                Predata = (STDdata)Grid_Minerals[i+1, 0].Tag;
                                 m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
 
                             if (i == 1)
@@ -371,137 +291,68 @@ namespace OTSPartA_STDEditor
                 Grid_MineralsDelRow();
             }
         }
-
         public int ChangeSTDRulesLISTBackColor()
         {
-            if (Grid_Minerals.RowsCount > 1)
+            if (tabControl1.SelectedIndex == 1)
             {
-                Position pos = new Position(1, 0);
-                Grid_Minerals[1, 0].Grid.Select();
+                if (Grid_Minerals.RowsCount > 1)
+                {
+                    Position pos = new Position(1, 0);
+                    Grid_Minerals[1, 0].Grid.Select();
 
-                Grid_Minerals[Grid_Minerals.Selection.ActivePosition.Row, 1].View.BackColor = m_MainForm.m_Attributes.Grid_Attributes[3, 1].View.BackColor;
-                m_MainForm._sTDEditor.STDDictionary[(int)Grid_Minerals[Grid_Minerals.Selection.ActivePosition.Row, 0].Tag].Color= Attributes.colorRGBtoHx16(m_MainForm.m_Attributes.Grid_Attributes[3, 1].View.BackColor.R, m_MainForm.m_Attributes.Grid_Attributes[3, 1].View.BackColor.G, m_MainForm.m_Attributes.Grid_Attributes[3, 1].View.BackColor.B);
-                Grid_Minerals.Refresh();
-                return (int)Grid_Minerals[Grid_Minerals.Selection.ActivePosition.Row, 0].Tag;
+                    Grid_Minerals[Grid_Minerals.Selection.ActivePosition.Row, 1].View.BackColor = m_MainForm.m_Attributes.Grid_Attributes[3, 1].View.BackColor;
+                    m_MainForm._sTDEditor.STDDictionary[((STDdata)Grid_Minerals[Grid_Minerals.Selection.ActivePosition.Row, 0].Tag).STDId].Color = Attributes.colorRGBtoHx16(m_MainForm.m_Attributes.Grid_Attributes[3, 1].View.BackColor.R, m_MainForm.m_Attributes.Grid_Attributes[3, 1].View.BackColor.G, m_MainForm.m_Attributes.Grid_Attributes[3, 1].View.BackColor.B);
+                    Grid_Minerals.Refresh();
+                    return ((STDdata)Grid_Minerals[Grid_Minerals.Selection.ActivePosition.Row, 0].Tag).STDId;
+                }
+                else
+                {
+                    return -1;
+                }
             }
             else
             {
-                return -1;
+                if(treeView_G.SelectedNode.Level==0)
+                {
+                    return -1;
+                }
+                STDdata ddata = (STDdata)treeView_G.SelectedNode.Tag;
+                int id= ddata.STDId;
+                m_MainForm._sTDEditor.STDDictionary[id].Color = Attributes.colorRGBtoHx16(m_MainForm.m_Attributes.Grid_Attributes[3, 1].View.BackColor.R, m_MainForm.m_Attributes.Grid_Attributes[3, 1].View.BackColor.G, m_MainForm.m_Attributes.Grid_Attributes[3, 1].View.BackColor.B);
+                InitGroupView();
+                foreach(TreeNode treeNode in treeView_G.Nodes)
+                {
+                    if(((STDGroups)treeNode.Tag).id== ddata.GroupId)
+                    {
+                        foreach (TreeNode node in treeNode.Nodes)
+                        {
+                            if (((STDdata)node.Tag).STDId == id)
+                            {
+                                treeView_G.SelectedNode = node;
+                                Predata = (STDdata)node.Tag;
+                            }
+                        }
+                    }
+                }
+                return id;
             }
         }
-
-        private void MenuStrip_STDRulelist_Resize(object sender, EventArgs e)
-        {
-        }
-
         private void button_UpOrder_Click(object sender, EventArgs e)
         {
-            Grid_Minerals.Focus(true);
-            int selrow = Grid_Minerals.Selection.ActivePosition.Row;
-
-            int id = (int)Grid_Minerals[selrow, 0].Tag;
-            int id2 = (int)Grid_Minerals[selrow - 1, 0].Tag;
-            string sname = Grid_Minerals[selrow, 0].Value.ToString();
-
-            Grid_Minerals[selrow, 0].Value = Grid_Minerals[selrow - 1, 0].Value;
-            Grid_Minerals[selrow, 0].Tag = id2;
-            SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
-            view.BackColor = colorHx16toRGB(m_MainForm._sTDEditor.STDDictionary[id2].Color);
-            Grid_Minerals[selrow, 1].View = view;
-
-            Grid_Minerals[selrow - 1, 0].Value = sname;
-            Grid_Minerals[selrow - 1, 0].Tag = id;
-            SourceGrid.Cells.Views.Cell view2 = new SourceGrid.Cells.Views.Cell();
-            view2.BackColor = colorHx16toRGB(m_MainForm._sTDEditor.STDDictionary[id].Color);
-            Grid_Minerals[selrow - 1, 1].View = view2;
-
-            m_MainForm._sTDEditor.STDDictionary[id].StrName = Grid_Minerals[selrow - 1, 0].Value.ToString();
-            m_MainForm._sTDEditor.STDDictionary[id2].StrName = Grid_Minerals[selrow, 0].Value.ToString();
-
-            Position pos = new Position(selrow - 1, 1);
-            Grid_Minerals[selrow - 1, 0].Grid.Select();
-            Grid_Minerals.Selection.Focus(pos, true);
-            PreRow = selrow - 1;
-
-            button_DownOrder.Enabled = true;
-            if (selrow - 1 == 1)
-            {
-                button_UpOrder.Enabled = false;
-            }
-            m_MainForm.IsModified = true;
-            Grid_Minerals.Refresh();
-            //m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(Grid_Minerals[selrow-1, 0].Tag.ToString()));
+            
         }
-
         private void button_DownOrder_Click(object sender, EventArgs e)
         {
-            Grid_Minerals.Focus(true);
-            int selrow = Grid_Minerals.Selection.ActivePosition.Row;
-
-            int id = (int)Grid_Minerals[selrow, 0].Tag;
-            int id2 = (int)Grid_Minerals[selrow + 1, 0].Tag;
-            string sname = Grid_Minerals[selrow, 0].Value.ToString();
-
-            Grid_Minerals[selrow, 0].Value = Grid_Minerals[selrow + 1, 0].Value;
-            Grid_Minerals[selrow, 0].Tag = id2;
-            SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
-            view.BackColor = colorHx16toRGB(m_MainForm._sTDEditor.STDDictionary[id2].Color);
-            Grid_Minerals[selrow, 1].View = view;
-
-            Grid_Minerals[selrow + 1, 0].Value = sname;
-            Grid_Minerals[selrow + 1, 0].Tag = id;
-            SourceGrid.Cells.Views.Cell view2 = new SourceGrid.Cells.Views.Cell();
-            view2.BackColor = colorHx16toRGB(m_MainForm._sTDEditor.STDDictionary[id].Color);
-            Grid_Minerals[selrow + 1, 1].View = view2;
-
-            m_MainForm._sTDEditor.STDDictionary[id].StrName = Grid_Minerals[selrow + 1, 0].Value.ToString();
-            m_MainForm._sTDEditor.STDDictionary[id2].StrName = Grid_Minerals[selrow, 0].Value.ToString();
-
-            Position pos = new Position(selrow + 1, 0);
-            Grid_Minerals[selrow + 1, 0].Grid.Select();
-            Grid_Minerals.Selection.Focus(pos, true);
-
-            PreRow = selrow + 1;
-
-            button_UpOrder.Enabled = true;
-            if (selrow + 1 == Grid_Minerals.RowsCount - 1)
-            {
-                button_DownOrder.Enabled = false;
-            }
-            #region 添加修改stdid顺序 ,由于需求改变只完成一部分(差相应修改能谱部分)
-            //DialogResult result=MessageBox.Show("检测到顺序已修改,是否调整STDId?", "提示",MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
-            //if (result == DialogResult.Yes)
-            //{
-            //    ChangeSTDidFromNum changeSTDidFromNum = new ChangeSTDidFromNum();
-            //    DialogResult res=changeSTDidFromNum.ShowDialog();
-            //    {
-            //        if (res == DialogResult.OK)
-            //        {
-            //            int StartId = int.Parse(changeSTDidFromNum.textBox_NewFirstSTDId.Text);
-            //            Dictionary<int, STDdata> STDDictionaryCopy = new Dictionary<int, STDdata>();
-            //            for (int i = 0; i < Grid_Minerals.RowsCount-1; i++)
-            //            {
-            //                STDdata dataCopy = m_MainForm._sTDEditor.STDDictionary[(int)Grid_Minerals[i+1, 0].Tag];
-            //                STDDictionaryCopy.Add(StartId + i, dataCopy);
-            //            }
-            //            m_MainForm._sTDEditor.STDDictionary.Clear();
-            //            m_MainForm._sTDEditor.STDDictionary = STDDictionaryCopy;
-            //        }
-            //    }
-            //}
-            #endregion
-            m_MainForm.IsModified = true;
-            Grid_Minerals.Refresh();
+            
         }
 
         public void InsertNewRow(int STDId, string RuleName, Color color)
         {
             Grid_Minerals.Focus(true);
             Grid_Minerals.Rows.InsertRange(Grid_Minerals.Selection.ActivePosition.Row, 1);
-            //Grid_Minerals.Rows.Insert(Grid_Minerals.Rows.Count);
             int i = Grid_Minerals.Selection.ActivePosition.Row;
             Grid_Minerals[Grid_Minerals.Selection.ActivePosition.Row, 0] = new SourceGrid.Cells.Cell(RuleName, typeof(string));
-            Grid_Minerals[Grid_Minerals.Selection.ActivePosition.Row, 0].Tag = STDId;
+            Grid_Minerals[Grid_Minerals.Selection.ActivePosition.Row, 0].Tag = m_MainForm._sTDEditor.STDDictionary[STDId];
             Grid_Minerals.Rows[Grid_Minerals.Selection.ActivePosition.Row].Height = 25;
             Grid_Minerals[Grid_Minerals.Selection.ActivePosition.Row, 1] = new SourceGrid.Cells.Cell();
             m_MainForm.ChangeSTDEditorAndGrid_Attributes(STDId);
@@ -510,19 +361,11 @@ namespace OTSPartA_STDEditor
             SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
             view.BackColor = color;
             Grid_Minerals[Grid_Minerals.Selection.ActivePosition.Row, 1].View = view;
-
             Position pos = new Position(Grid_Minerals.Selection.ActivePosition.Row, 0);
             Grid_Minerals.Selection.Focus(pos, true);
-
-            PreRow = Grid_Minerals.Selection.ActivePosition.Row - 1;
+            Predata = (STDdata)Grid_Minerals[Grid_Minerals.Selection.ActivePosition.Row - 1, 0].Tag ;
             SetOrderButtonsStatus();
         }
-
-        private void Grid_Minerals_VScrollPositionChanged(object sender, ScrollPositionChangedEventArgs e)
-        {
-            //Grid_Minerals.Refresh();
-        }
-
         void SetOrderButtonsStatus()
         {
             Grid_Minerals.Focus();
@@ -549,68 +392,418 @@ namespace OTSPartA_STDEditor
             }
             else
             {
-                button_UpOrder.Enabled = false;
-                button_DownOrder.Enabled = false;
+                button_UpOrder.Enabled = false;button_DownOrder.Enabled = false;
             }
         }
+
+
         private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
         {
+            if (Predata != null)
+            {
+                m_MainForm.SaveDataOfSelRule(Predata.STDId);
+            }
             if (tabControl1.SelectedIndex == 0)
             {
+                Predata = null;
                 InitGroupEditorView();
             }
             else if (tabControl1.SelectedIndex == 1)
             {
                 ConvertToRuleViewDic();
+                InitRuleView();
+                //int i = Grid_Minerals.Selection.ActivePosition.Row;
+                //int j = Grid_Minerals.Selection.ActivePosition.Column;
+                //if (i >= 0 && j >= 0)
+                //{
+                //    int id = ((STDdata)Grid_Minerals[i, 0].Tag).STDId;
+                //    if (m_MainForm._sTDEditor.STDDictionary.ContainsKey(id))
+                //    {
+                //        m_MainForm.ChangeSTDEditorAndGrid_Attributes(id);
+                //        Predata = (STDdata)Grid_Minerals[i, 0].Tag;
+                //    }
+                if (m_MainForm._sTDEditor.STDDictionary.Count == 0)
+                {
+                    m_MainForm.SetNull();
+                    Predata = null;
+                }
+                else
+                {
+
+                    Position pos = new Position(1, 0);
+                    Grid_Minerals[1, 0].Grid.Select();
+                    Grid_Minerals.Selection.Focus(pos, true);
+                    Grid_Minerals.Refresh();
+                    m_MainForm.ChangeSTDEditorAndGrid_Attributes(((STDdata)Grid_Minerals[1, 0].Tag).STDId);
+                    
+                    Predata = (STDdata)Grid_Minerals[1, 0].Tag;
+                }
+                //}
             }
         }
         void InitGroupEditorView()
         {
             GroupViewDic = ConvertToGroupViewDic();
-            foreach(STDGroups group in GroupViewDic.Values)
+            InitGroupView();
+        }
+
+        Dictionary<int, STDGroups> ConvertToGroupViewDic()
+        {
+            Dictionary<int, STDGroups> keyValuePairs = new Dictionary<int, STDGroups>();
+            keyValuePairs = m_MainForm._sTDEditor.GroupDictionary;
+            foreach (STDGroups group in keyValuePairs.Values)
+            {
+                group.ContainSTD.Clear();
+            }
+            foreach (STDdata Ddata in  m_MainForm._sTDEditor.STDDictionary.Values)
+            {
+                keyValuePairs[Ddata.GroupId].ContainSTD.Add(Ddata);
+            }
+            return keyValuePairs;
+        }
+        public void ConvertToRuleViewDic()
+        {
+            m_MainForm._sTDEditor.GroupIdDictionaryFromId.Clear();
+            m_MainForm._sTDEditor.GroupIdDictionaryFromName.Clear();
+            m_MainForm._sTDEditor.STDDictionary.Clear();
+            foreach (STDGroups group in GroupViewDic.Values)
+            {
+                foreach (STDdata Ddata in group.ContainSTD)
+                {
+                    m_MainForm._sTDEditor.STDDictionary.Add(Ddata.STDId, Ddata);
+                }
+                m_MainForm._sTDEditor.GroupIdDictionaryFromName.Add(group.name.ToString(), int.Parse(group.id.ToString()));
+                m_MainForm._sTDEditor.GroupIdDictionaryFromId.Add(int.Parse(group.id.ToString()), group.name.ToString());
+            }
+            if (treeView_G.SelectedNode == null){return;}
+            if (treeView_G.SelectedNode.Level == 1)
+            {
+                m_MainForm.SaveDataOfSelRule(((STDdata)treeView_G.SelectedNode.Tag).STDId);
+            }
+        }
+
+
+
+
+
+        private void ToolStripMenuItem_NewGroup_Click(object sender, EventArgs e)
+        {
+            STDGroups group = new STDGroups();
+            int id = 0;
+            foreach(STDGroups grp in GroupViewDic.Values)
+            {
+                if(grp.id>id)
+                {
+                    id= grp.id;
+                }
+            }
+            id++;
+            group.id = id;
+            group.name = "Group" + id.ToString();
+            group.color = Attributes.colorRGBtoHx16(Color.WhiteSmoke.R, Color.WhiteSmoke.G, Color.WhiteSmoke.B);
+            GroupViewDic.Add(group.id, group);
+            m_MainForm.m_Attributes.AddSTDGroupsToAttribute();
+            this.Refresh();
+            TreeNode treeNode = new TreeNode();
+            treeNode.Tag = group;
+            treeNode.Text = group.name;
+            m_MainForm._sTDEditor.GroupIdDictionaryFromId.Add(id, group.name);
+            m_MainForm._sTDEditor.GroupIdDictionaryFromName.Add(group.name, group.id);
+            treeView_G.Nodes.Add(treeNode);
+            treeView_G.SelectedNode = treeNode;
+            m_MainForm.SetNull();
+            Predata = null;
+        }
+
+
+
+        private void ToolStripMenuItem_DelGroup_Click(object sender, EventArgs e)
+        {
+            if(treeView_G.SelectedNode==null)
+            {
+                MessageBox.Show("Please select a group!", "Tip");
+                return;
+            }
+            if (treeView_G.SelectedNode.Level == 0)
+            {
+                int id = ((STDGroups)treeView_G.SelectedNode.Tag).id;
+                if(((STDGroups)treeView_G.SelectedNode.Tag).id==0)
+                {
+                    MessageBox.Show("Can not delete the group which named default!", "Tip");
+                    return;
+                }
+                DialogResult result = MessageBox.Show("删除组会一并删除组内规则,是否继续?", "Tip", MessageBoxButtons.YesNo);
+                if (result == DialogResult.Yes)
+                {
+                    m_MainForm._sTDEditor.GroupIdDictionaryFromId.Remove(id);
+                    m_MainForm._sTDEditor.GroupIdDictionaryFromName.Remove(GroupViewDic[id].name);
+                    GroupViewDic.Remove(id);
+                    treeView_G.Nodes.Remove(treeView_G.SelectedNode);
+                    this.Refresh();
+                }
+            }
+            else
+            {
+                MessageBox.Show("Please select a group!", "Tip");
+                return;
+            }
+        }
+        private void ToolStripMenuItem_EdGroupColor_Click(object sender, EventArgs e)
+        {
+            if(treeView_G.SelectedNode==null)
+            {
+                MessageBox.Show("Please select a group!", "Tip");
+                return;
+            }
+            if (treeView_G.SelectedNode.Level == 0)
+            {
+                ColorDialog cd = new ColorDialog();
+                cd.FullOpen = true;//自定义颜色界面打开
+                DialogResult result = cd.ShowDialog();
+                if (result == DialogResult.OK)
+                {
+                    GroupViewDic[((STDGroups)treeView_G.SelectedNode.Tag).id].color = Attributes.colorRGBtoHx16(cd.Color.R, cd.Color.G, cd.Color.B);
+                    InitGroupView();
+                }
+            }
+            else
+            {
+                MessageBox.Show("Please select a group!", "Tip");
+            }
+        }
+
+        void InitGroupView()
+        {
+            treeView_G.ImageList=new ImageList();
+            treeView_G.Nodes.Clear();
+            treeView_G.ImageList.ColorDepth = ColorDepth.Depth32Bit;
+            foreach (STDGroups group in GroupViewDic.Values)
             {
                 TreeNode treeNode = new TreeNode();
                 treeNode.Tag = group;
-                treeNode.Text=group.name;
-                treeNode.BackColor= Attributes.colorHx16toRGB(group.color);
+                treeNode.Text = group.name;
+                Color color = Attributes.colorHx16toRGB(group.color);
+                Bitmap bitmap = new Bitmap(100, 100, PixelFormat.Format32bppArgb);
+                Graphics graphics = Graphics.FromImage(bitmap);
+                SolidBrush b1 = new SolidBrush(color);
+                graphics.FillEllipse(b1, new Rectangle(0, 0, 100, 100));
+                treeView_G.ImageList.Images.Add(group.id.ToString(),bitmap);
+                treeNode.ImageKey = group.id.ToString();
+                treeNode.SelectedImageKey = group.id.ToString();
                 treeView_G.Nodes.Add(treeNode);
-                foreach(STDdata ddata in group.ContainSTD)
+                foreach (STDdata ddata in group.ContainSTD)
                 {
                     TreeNode childtreeNode = new TreeNode();
                     childtreeNode.Tag = ddata;
                     childtreeNode.Text = ddata.StrName;
+                    Color color2 = Attributes.colorHx16toRGB(ddata.Color);
+                    SolidBrush b2 = new SolidBrush(color2);
+                    graphics.FillEllipse(b2, new Rectangle(0, 0, 100, 100));
+                    treeView_G.ImageList.Images.Add("0x"+ ddata.STDId, bitmap);
+                    //bitmap.Save(@"C:\Users\yunyunyun\Desktop\9-9-1\a\"+ ddata.STDId + @".bmp");
+                    childtreeNode.ImageKey = "0x" + ddata.STDId;
+                    childtreeNode.SelectedImageKey = "0x" + ddata.STDId;
                     treeNode.Nodes.Add(childtreeNode);
                 }
             }
 
             treeView_G.Font = new Font("微软雅黑", 12);
-            treeView_G.ShowLines=false;
-            //treeView_G.ExpandAll();
+            treeView_G.ShowLines = false;
             this.Refresh();
         }
-        Dictionary<int, STDGroups> ConvertToGroupViewDic()
+        void InitRuleView()
         {
-            Dictionary<int, STDGroups> keyValuePairs = new Dictionary<int, STDGroups>();
-            keyValuePairs = m_MainForm._sTDEditor.GroupDictionary;
-            foreach (STDGroups group in keyValuePairs.Values)
+            Grid_Minerals.Rows.Clear();
+            Grid_Minerals.Columns.Clear();
+
+            Grid_Minerals.Redim(m_MainForm._sTDEditor.STDDictionary.Count + 1, 2);
+            SourceGrid.Cells.ColumnHeader head1 = null;
+            if (m_MainForm.lan.GetNameTable("Form_Main")["language"].ToString() == "EN")
             {
-                group.ContainSTD.Clear();
+                head1 = new SourceGrid.Cells.ColumnHeader("Rule Name");
             }
-            foreach (STDdata Ddata in  m_MainForm._sTDEditor.STDDictionary.Values)
+            else
             {
-                keyValuePairs[int.Parse(Ddata.GroupId)].ContainSTD.Add(Ddata);
+                head1 = new SourceGrid.Cells.ColumnHeader("规则名称");
             }
-            return keyValuePairs;
+            Grid_Minerals[0, 0] = head1;
+
+            SourceGrid.Cells.ColumnHeader head2 = null;
+            if (m_MainForm.lan.GetNameTable("Form_Main")["language"].ToString() == "EN")
+            {
+                head2 = new SourceGrid.Cells.ColumnHeader("Color");
+            }
+            else
+            {
+                head2 = new SourceGrid.Cells.ColumnHeader("颜色");
+            }
+            Grid_Minerals[0, 1] = head2;
+            SourceGrid.Cells.Views.ColumnHeader boldHeader = new SourceGrid.Cells.Views.ColumnHeader();
+            boldHeader.Font = new Font("Microsoft YaHei UI", 11, FontStyle.Bold);
+            boldHeader.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
+            Grid_Minerals[0, 0].View = boldHeader;
+            Grid_Minerals[0, 1].View = boldHeader;
+            Grid_Minerals.Rows.SetHeight(0, 25);
+            head1.AutomaticSortEnabled = false;
+            head2.AutomaticSortEnabled = false;
+            Grid_Minerals.Selection.EnableMultiSelection = false;
+            Grid_Minerals.AutoStretchColumnsToFitWidth = true;
+            Grid_Minerals.Columns[0].Width = this.Width / 2 - 15;
+            Grid_Minerals.Columns[1].Width = this.Width / 2 - 39;
+            int i = 1;
+            foreach (KeyValuePair<int, STDdata> kv in m_MainForm._sTDEditor.STDDictionary)
+            {
+                Grid_Minerals[i, 0] = new SourceGrid.Cells.Cell(kv.Value.StrName, typeof(string));
+                Grid_Minerals.Rows[i].Height = 25;
+                Grid_Minerals[i, 0].Tag = kv.Value;
+                Grid_Minerals[i, 1] = new SourceGrid.Cells.Cell();
+                SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
+                view.BackColor = colorHx16toRGB(kv.Value.Color);
+                Grid_Minerals[i, 1].View = view;
+                i++;
+            }
+            Grid_Minerals.Controller.AddController(m_ValueChangedEvent);
+            Grid_Minerals.FixedRows = 1;
+            Grid_Minerals.Selection.FocusStyle = FocusStyle.None;
         }
-        void ConvertToRuleViewDic()
+
+        private void treeView_G_ItemDrag(object sender, ItemDragEventArgs e)
         {
-            foreach (STDGroups group in GroupViewDic.Values)
+            if (e.Button == MouseButtons.Left)
             {
-                foreach (STDdata Ddata in group.ContainSTD)
+                //只处理左键拖拽操作;
+                m_targetNode = null;
+                TreeNode _node = (TreeNode)e.Item;
+                //只允许拖拽子级节点;
+                if (_node.Level > 0)
                 {
-                    m_MainForm._sTDEditor.STDDictionary[int.Parse(Ddata.STDId)].GroupId = group.id.ToString();
+                    //开始拖拽;
+                    DoDragDrop(e.Item, DragDropEffects.Move | DragDropEffects.Copy);
                 }
             }
         }
+        TreeNode m_targetNode;      //用于记录当前拖拽到的目标节点;
+        private void treeView_G_DragDrop(object sender, DragEventArgs e)
+        {
+            if (m_targetNode != null)
+            {
+                TreeNode _node = (TreeNode)e.Data.GetData(typeof(TreeNode));
+                if (!m_targetNode.Equals(_node))
+                {
+
+                    if (m_targetNode.Level == _node.Level)
+                    {
+                        //1. 不同的父节点;
+                        //2. 被拖拽的节点不在目标节点的上面(相邻);
+                        if (!_node.Parent.Equals(m_targetNode.Parent) || m_targetNode.Index - 1 != _node.Index)
+                        {
+                            _node.Remove();
+                            m_targetNode.Parent.Nodes.Insert(m_targetNode.Index, _node);
+                            m_targetNode.Parent.ExpandAll();
+                        }
+                    }
+                    else
+                    {
+                        GroupViewDic[((STDGroups)_node.Parent.Tag).id].ContainSTD.Remove((STDdata)_node.Tag);
+                        _node.Remove();
+                        ((STDdata)_node.Tag).GroupId = ((STDGroups)m_targetNode.Tag).id;
+                        m_targetNode.Nodes.Add(_node);
+                        GroupViewDic[((STDGroups)m_targetNode.Tag).id].ContainSTD.Add((STDdata)_node.Tag);
+                        treeView_G.SelectedNode = _node; // 选中节点
+                        m_targetNode.Expand(); // 展开父节点
+                        m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(((STDdata)_node.Tag).STDId.ToString()));
+                        Predata = (STDdata)_node.Tag;
+                    }
+                }
+                m_targetNode = null;
+                _node = null;
+            }
+        }
+
+        [DllImport("user32.dll")]
+        private static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam,int lParam);
+
+        private void treeView_G_DragOver(object sender, DragEventArgs e)
+        {
+            const Single scrollRegion = 20;
+            Point pt = treeView_G.PointToClient(Cursor.Position);
+            if ((pt.Y + scrollRegion) > treeView_G.Height)
+            {
+                SendMessage(treeView_G.Handle, (int)277, (int)1, 0);
+            }
+            else if (pt.Y < (treeView_G.Top + scrollRegion))
+            {
+                SendMessage(treeView_G.Handle, (int)277, (int)0, 0);
+            }
+            TreeNode _node2 = treeView_G.GetNodeAt(treeView_G.PointToClient(new Point(e.X, e.Y)));
+            m_targetNode = null;
+
+            if (_node2 != null)
+            {
+                m_targetNode = _node2;
+                e.Effect = DragDropEffects.Move;
+            }
+            else
+            {
+                e.Effect = DragDropEffects.None;
+            }
+        }
+        private void treeView_G_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
+        {
+            if(Predata!=null)
+            {
+                m_MainForm.SaveDataOfSelRule(Predata.STDId);
+            }
+            if(e.Node.Level==0)
+            {
+                m_MainForm.SetNull();
+                Predata = null;
+            }
+            else
+            {
+                m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(((STDdata)e.Node.Tag).STDId.ToString()));
+                Predata = (STDdata)e.Node.Tag;
+            }
+        }
+        public void AdjustTreenodeByGroup(int Groupid)
+        {
+            if (m_MainForm.m_STDRuleslist.tabControl1.SelectedIndex == 1)
+            {
+                return;
+            }
+            if (treeView_G.SelectedNode.Level == 0)
+            {
+                return;
+            }
+            STDdata ddata = (STDdata)treeView_G.SelectedNode.Tag;
+            TreeNode nodenew = null;
+            foreach (TreeNode node in treeView_G.Nodes)
+            {
+                if (((STDGroups)node.Tag).id == Groupid)
+                {
+                    nodenew = node;break;
+                }
+            }
+            foreach (TreeNode node in treeView_G.Nodes)
+            {
+                foreach (TreeNode node1 in node.Nodes)
+                {
+                    if (((STDdata)node1.Tag).STDId == ddata.STDId)
+                    {
+                        GroupViewDic[((STDGroups)node.Tag).id].ContainSTD.Remove(ddata);
+                        node1.Remove();
+                        ((STDdata)node1.Tag).GroupId = ddata.GroupId;
+                        nodenew.Nodes.Add(node1);
+                        GroupViewDic[Groupid].ContainSTD.Add(ddata);
+                        treeView_G.SelectedNode = node1;
+                        nodenew.Expand();
+                        m_MainForm.ChangeSTDEditorAndGrid_Attributes(int.Parse(((STDdata)node1.Tag).STDId.ToString()));
+                        Predata = ddata;
+                        break;
+                    }
+                }
+
+            }
+        }
     }
 }

+ 3 - 0
OTSPartA_STDEditor/UI/STDRuleslist.resx

@@ -120,4 +120,7 @@
   <metadata name="MenuStrip_STDRulelist.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
   </metadata>
+  <metadata name="contextMenuStrip_GroupView.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>201, 17</value>
+  </metadata>
 </root>

+ 11 - 229
OTSSysMgrApp/ControllerSettingForm.Designer.cs

@@ -57,22 +57,6 @@
             this.tbCollectionTime = new System.Windows.Forms.TextBox();
             this.label2 = new System.Windows.Forms.Label();
             this.lblCollectionTime = new System.Windows.Forms.Label();
-            this.tabImage2 = new System.Windows.Forms.TabPage();
-            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
-            this.btn_Recommendedconfiguration = new System.Windows.Forms.Button();
-            this.label5 = new System.Windows.Forms.Label();
-            this.cb_imageresolution = new System.Windows.Forms.ComboBox();
-            this.label4 = new System.Windows.Forms.Label();
-            this.label3 = new System.Windows.Forms.Label();
-            this.tB_scanFieldSize100 = new System.Windows.Forms.TextBox();
-            this.label1 = new System.Windows.Forms.Label();
-            this.btn_confirm = new System.Windows.Forms.Button();
-            this.cb_Ydirection = new System.Windows.Forms.ComboBox();
-            this.label_y = new System.Windows.Forms.Label();
-            this.cb_Xdirection = new System.Windows.Forms.ComboBox();
-            this.label_x = new System.Windows.Forms.Label();
-            this.btn_continuousshot = new System.Windows.Forms.Button();
-            this.panel2 = new System.Windows.Forms.Panel();
             this.tabSetting.SuspendLayout();
             this.tabImage.SuspendLayout();
             this.groupBox2.SuspendLayout();
@@ -81,24 +65,18 @@
             this.tabXRay.SuspendLayout();
             this.groupBox1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.chartXRay)).BeginInit();
-            this.tabImage2.SuspendLayout();
-            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
-            this.splitContainer1.Panel1.SuspendLayout();
-            this.splitContainer1.Panel2.SuspendLayout();
-            this.splitContainer1.SuspendLayout();
             this.SuspendLayout();
             // 
             // tabSetting
             // 
             this.tabSetting.Controls.Add(this.tabImage);
             this.tabSetting.Controls.Add(this.tabXRay);
-            this.tabSetting.Controls.Add(this.tabImage2);
             this.tabSetting.Dock = System.Windows.Forms.DockStyle.Fill;
             this.tabSetting.Location = new System.Drawing.Point(0, 0);
             this.tabSetting.Margin = new System.Windows.Forms.Padding(2);
             this.tabSetting.Name = "tabSetting";
             this.tabSetting.SelectedIndex = 0;
-            this.tabSetting.Size = new System.Drawing.Size(1050, 770);
+            this.tabSetting.Size = new System.Drawing.Size(959, 770);
             this.tabSetting.TabIndex = 2;
             // 
             // tabImage
@@ -115,7 +93,7 @@
             this.tabImage.Margin = new System.Windows.Forms.Padding(2);
             this.tabImage.Name = "tabImage";
             this.tabImage.Padding = new System.Windows.Forms.Padding(2);
-            this.tabImage.Size = new System.Drawing.Size(1042, 744);
+            this.tabImage.Size = new System.Drawing.Size(951, 744);
             this.tabImage.TabIndex = 1;
             this.tabImage.Text = "BSE测试";
             this.tabImage.UseVisualStyleBackColor = true;
@@ -146,7 +124,7 @@
             this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox2.Name = "groupBox2";
             this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
-            this.groupBox2.Size = new System.Drawing.Size(1029, 692);
+            this.groupBox2.Size = new System.Drawing.Size(938, 692);
             this.groupBox2.TabIndex = 13;
             this.groupBox2.TabStop = false;
             this.groupBox2.Text = "图像显示";
@@ -159,7 +137,7 @@
             this.panel1.Location = new System.Drawing.Point(2, 16);
             this.panel1.Margin = new System.Windows.Forms.Padding(2);
             this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(1025, 674);
+            this.panel1.Size = new System.Drawing.Size(934, 674);
             this.panel1.TabIndex = 2;
             // 
             // pbImage
@@ -169,7 +147,7 @@
             this.pbImage.Location = new System.Drawing.Point(0, 0);
             this.pbImage.Margin = new System.Windows.Forms.Padding(2);
             this.pbImage.Name = "pbImage";
-            this.pbImage.Size = new System.Drawing.Size(1025, 674);
+            this.pbImage.Size = new System.Drawing.Size(934, 674);
             this.pbImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.pbImage.TabIndex = 0;
             this.pbImage.TabStop = false;
@@ -177,7 +155,7 @@
             // btnClear
             // 
             this.btnClear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
-            this.btnClear.Location = new System.Drawing.Point(957, 77);
+            this.btnClear.Location = new System.Drawing.Point(866, 77);
             this.btnClear.Margin = new System.Windows.Forms.Padding(2);
             this.btnClear.Name = "btnClear";
             this.btnClear.Size = new System.Drawing.Size(67, 50);
@@ -190,7 +168,7 @@
             // btnSaveImage
             // 
             this.btnSaveImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
-            this.btnSaveImage.Location = new System.Drawing.Point(478, 8);
+            this.btnSaveImage.Location = new System.Drawing.Point(387, 8);
             this.btnSaveImage.Margin = new System.Windows.Forms.Padding(2);
             this.btnSaveImage.Name = "btnSaveImage";
             this.btnSaveImage.Size = new System.Drawing.Size(67, 33);
@@ -203,7 +181,7 @@
             // btnDisplay
             // 
             this.btnDisplay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
-            this.btnDisplay.Location = new System.Drawing.Point(684, 8);
+            this.btnDisplay.Location = new System.Drawing.Point(593, 8);
             this.btnDisplay.Margin = new System.Windows.Forms.Padding(2);
             this.btnDisplay.Name = "btnDisplay";
             this.btnDisplay.Size = new System.Drawing.Size(133, 33);
@@ -267,7 +245,7 @@
             this.tabXRay.Margin = new System.Windows.Forms.Padding(2);
             this.tabXRay.Name = "tabXRay";
             this.tabXRay.Padding = new System.Windows.Forms.Padding(2);
-            this.tabXRay.Size = new System.Drawing.Size(1042, 744);
+            this.tabXRay.Size = new System.Drawing.Size(951, 744);
             this.tabXRay.TabIndex = 0;
             this.tabXRay.Text = "X-Ray测试";
             this.tabXRay.UseVisualStyleBackColor = true;
@@ -299,7 +277,7 @@
             this.chartXRay.Name = "chartXRay";
             series1.ChartArea = "ChartArea1";
             series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
-            series1.CustomProperties = "PixelPointWidth=1, PointWidth=0.1, MaxPixelPointWidth=2000";
+            series1.CustomProperties = "MaxPixelPointWidth=2000, PointWidth=0.1, PixelPointWidth=1";
             series1.LabelBorderDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.NotSet;
             series1.LabelBorderWidth = 0;
             series1.MarkerSize = 1;
@@ -424,186 +402,12 @@
             this.lblCollectionTime.TabIndex = 0;
             this.lblCollectionTime.Text = "采集时间";
             // 
-            // tabImage2
-            // 
-            this.tabImage2.Controls.Add(this.splitContainer1);
-            this.tabImage2.Location = new System.Drawing.Point(4, 22);
-            this.tabImage2.Name = "tabImage2";
-            this.tabImage2.Padding = new System.Windows.Forms.Padding(3);
-            this.tabImage2.Size = new System.Drawing.Size(1042, 744);
-            this.tabImage2.TabIndex = 2;
-            this.tabImage2.Text = "轴方向测试";
-            this.tabImage2.UseVisualStyleBackColor = true;
-            // 
-            // splitContainer1
-            // 
-            this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            this.splitContainer1.Location = new System.Drawing.Point(7, 8);
-            this.splitContainer1.Name = "splitContainer1";
-            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
-            // 
-            // splitContainer1.Panel1
-            // 
-            this.splitContainer1.Panel1.Controls.Add(this.btn_Recommendedconfiguration);
-            this.splitContainer1.Panel1.Controls.Add(this.label5);
-            this.splitContainer1.Panel1.Controls.Add(this.cb_imageresolution);
-            this.splitContainer1.Panel1.Controls.Add(this.label4);
-            this.splitContainer1.Panel1.Controls.Add(this.label3);
-            this.splitContainer1.Panel1.Controls.Add(this.tB_scanFieldSize100);
-            this.splitContainer1.Panel1.Controls.Add(this.label1);
-            this.splitContainer1.Panel1.Controls.Add(this.btn_confirm);
-            this.splitContainer1.Panel1.Controls.Add(this.cb_Ydirection);
-            this.splitContainer1.Panel1.Controls.Add(this.label_y);
-            this.splitContainer1.Panel1.Controls.Add(this.cb_Xdirection);
-            this.splitContainer1.Panel1.Controls.Add(this.label_x);
-            this.splitContainer1.Panel1.Controls.Add(this.btn_continuousshot);
-            // 
-            // splitContainer1.Panel2
-            // 
-            this.splitContainer1.Panel2.Controls.Add(this.panel2);
-            this.splitContainer1.Size = new System.Drawing.Size(1029, 730);
-            this.splitContainer1.SplitterDistance = 85;
-            this.splitContainer1.TabIndex = 3;
-            // 
-            // btn_Recommendedconfiguration
-            // 
-            this.btn_Recommendedconfiguration.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.btn_Recommendedconfiguration.Location = new System.Drawing.Point(259, 41);
-            this.btn_Recommendedconfiguration.Name = "btn_Recommendedconfiguration";
-            this.btn_Recommendedconfiguration.Size = new System.Drawing.Size(75, 23);
-            this.btn_Recommendedconfiguration.TabIndex = 16;
-            this.btn_Recommendedconfiguration.Text = "推荐配置";
-            this.btn_Recommendedconfiguration.UseVisualStyleBackColor = true;
-            this.btn_Recommendedconfiguration.Click += new System.EventHandler(this.btn_Recommendedconfiguration_Click);
-            // 
-            // label5
-            // 
-            this.label5.AutoSize = true;
-            this.label5.Location = new System.Drawing.Point(391, 53);
-            this.label5.Name = "label5";
-            this.label5.Size = new System.Drawing.Size(131, 12);
-            this.label5.TabIndex = 15;
-            this.label5.Text = "请在 100 放大倍数调试";
-            // 
-            // cb_imageresolution
-            // 
-            this.cb_imageresolution.FormattingEnabled = true;
-            this.cb_imageresolution.Location = new System.Drawing.Point(66, 45);
-            this.cb_imageresolution.Name = "cb_imageresolution";
-            this.cb_imageresolution.Size = new System.Drawing.Size(121, 20);
-            this.cb_imageresolution.TabIndex = 14;
-            // 
-            // label4
-            // 
-            this.label4.AutoSize = true;
-            this.label4.Location = new System.Drawing.Point(7, 48);
-            this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
-            this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(47, 12);
-            this.label4.TabIndex = 13;
-            this.label4.Text = "分辨率:";
-            // 
-            // label3
-            // 
-            this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(597, 11);
-            this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(17, 12);
-            this.label3.TabIndex = 8;
-            this.label3.Text = "um";
-            // 
-            // tB_scanFieldSize100
-            // 
-            this.tB_scanFieldSize100.Location = new System.Drawing.Point(491, 7);
-            this.tB_scanFieldSize100.Name = "tB_scanFieldSize100";
-            this.tB_scanFieldSize100.Size = new System.Drawing.Size(100, 21);
-            this.tB_scanFieldSize100.TabIndex = 7;
-            this.tB_scanFieldSize100.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
-            // label1
-            // 
-            this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(391, 11);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(107, 12);
-            this.label1.TabIndex = 6;
-            this.label1.Text = "100倍下屏幕宽度:";
-            // 
-            // btn_confirm
-            // 
-            this.btn_confirm.Location = new System.Drawing.Point(827, 12);
-            this.btn_confirm.Name = "btn_confirm";
-            this.btn_confirm.Size = new System.Drawing.Size(75, 61);
-            this.btn_confirm.TabIndex = 5;
-            this.btn_confirm.Text = "保存";
-            this.btn_confirm.UseVisualStyleBackColor = true;
-            this.btn_confirm.Click += new System.EventHandler(this.btn_confirm_Click);
-            // 
-            // cb_Ydirection
-            // 
-            this.cb_Ydirection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.cb_Ydirection.FormattingEnabled = true;
-            this.cb_Ydirection.Location = new System.Drawing.Point(259, 7);
-            this.cb_Ydirection.Name = "cb_Ydirection";
-            this.cb_Ydirection.Size = new System.Drawing.Size(119, 20);
-            this.cb_Ydirection.TabIndex = 4;
-            // 
-            // label_y
-            // 
-            this.label_y.AutoSize = true;
-            this.label_y.Location = new System.Drawing.Point(193, 11);
-            this.label_y.Name = "label_y";
-            this.label_y.Size = new System.Drawing.Size(71, 12);
-            this.label_y.TabIndex = 3;
-            this.label_y.Text = "y轴正方向:";
-            // 
-            // cb_Xdirection
-            // 
-            this.cb_Xdirection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.cb_Xdirection.FormattingEnabled = true;
-            this.cb_Xdirection.Location = new System.Drawing.Point(68, 8);
-            this.cb_Xdirection.Name = "cb_Xdirection";
-            this.cb_Xdirection.Size = new System.Drawing.Size(119, 20);
-            this.cb_Xdirection.TabIndex = 2;
-            // 
-            // label_x
-            // 
-            this.label_x.AutoSize = true;
-            this.label_x.Location = new System.Drawing.Point(3, 11);
-            this.label_x.Name = "label_x";
-            this.label_x.Size = new System.Drawing.Size(71, 12);
-            this.label_x.TabIndex = 1;
-            this.label_x.Text = "x轴正方向:";
-            // 
-            // btn_continuousshot
-            // 
-            this.btn_continuousshot.Location = new System.Drawing.Point(649, 11);
-            this.btn_continuousshot.Name = "btn_continuousshot";
-            this.btn_continuousshot.Size = new System.Drawing.Size(163, 61);
-            this.btn_continuousshot.TabIndex = 0;
-            this.btn_continuousshot.Text = "轴方向验证";
-            this.btn_continuousshot.UseVisualStyleBackColor = true;
-            this.btn_continuousshot.Click += new System.EventHandler(this.btn_continuousshot_Click);
-            // 
-            // panel2
-            // 
-            this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            this.panel2.Location = new System.Drawing.Point(0, 0);
-            this.panel2.Name = "panel2";
-            this.panel2.Size = new System.Drawing.Size(1029, 641);
-            this.panel2.TabIndex = 2;
-            this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint);
-            // 
             // ControllerSettingForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.Color.White;
-            this.ClientSize = new System.Drawing.Size(1050, 770);
+            this.ClientSize = new System.Drawing.Size(959, 770);
             this.Controls.Add(this.tabSetting);
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
             this.Margin = new System.Windows.Forms.Padding(2);
@@ -623,12 +427,6 @@
             this.tabXRay.PerformLayout();
             this.groupBox1.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.chartXRay)).EndInit();
-            this.tabImage2.ResumeLayout(false);
-            this.splitContainer1.Panel1.ResumeLayout(false);
-            this.splitContainer1.Panel1.PerformLayout();
-            this.splitContainer1.Panel2.ResumeLayout(false);
-            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
-            this.splitContainer1.ResumeLayout(false);
             this.ResumeLayout(false);
 
         }
@@ -660,21 +458,5 @@
         private System.Windows.Forms.Button btnPointXRay;
         private System.Windows.Forms.Button btnClearData;
         private System.Windows.Forms.Button btnEanalysis;
-        private System.Windows.Forms.TabPage tabImage2;
-        private System.Windows.Forms.SplitContainer splitContainer1;
-        private System.Windows.Forms.Label label5;
-        private System.Windows.Forms.ComboBox cb_imageresolution;
-        private System.Windows.Forms.Label label4;
-        private System.Windows.Forms.Label label3;
-        private System.Windows.Forms.TextBox tB_scanFieldSize100;
-        private System.Windows.Forms.Label label1;
-        private System.Windows.Forms.Button btn_confirm;
-        private System.Windows.Forms.ComboBox cb_Ydirection;
-        private System.Windows.Forms.Label label_y;
-        private System.Windows.Forms.ComboBox cb_Xdirection;
-        private System.Windows.Forms.Label label_x;
-        private System.Windows.Forms.Button btn_continuousshot;
-        private System.Windows.Forms.Button btn_Recommendedconfiguration;
-        private System.Windows.Forms.Panel panel2;
     }
 }

+ 3 - 278
OTSSysMgrApp/ControllerSettingForm.cs

@@ -146,39 +146,6 @@ namespace OTSSysMgrApp
             int width = Convert.ToInt32(tbRWidth.Text);
             int height = Convert.ToInt32(tbRHeight.Text);
             m_EDSHardwareMgr = EDSController.GetEDSController(width, height, 5000,true,"");
-
-            cb_Xdirection.Items.Add("LEFT_TOWARD");
-            cb_Xdirection.Items.Add("RIGHT_TOWARD");
-            cb_Ydirection.Items.Add("UP_TOWARD");
-            cb_Ydirection.Items.Add("DOWN_TOWARD");
-            tB_scanFieldSize100.Text = "1270";
-            cb_imageresolution.Items.Add("1024*768");
-            cb_imageresolution.Items.Add("1024*704");
-            cb_imageresolution.Items.Add("1536*1024");
-            string xmlpath = Application.StartupPath + @"\Config\SysData\OTSProgMgrParam.pmf";
-            string xAxisDir = "";
-            string yAxisDir = "";
-            string scanFieldSize = "";
-            ReadConfigXml(xmlpath, ref xAxisDir, ref yAxisDir, ref scanFieldSize);
-            if (xAxisDir.Split(':')[1] == "LEFT_TOWARD")
-            {
-                cb_Xdirection.SelectedIndex = 0;
-            }
-            else
-            {
-                cb_Xdirection.SelectedIndex = 1;
-            }
-            if (yAxisDir.Split(':')[1] == "UP_TOWARD")
-            {
-                cb_Ydirection.SelectedIndex = 0;
-            }
-            else
-            {
-                cb_Ydirection.SelectedIndex = 1;
-            }
-            tB_scanFieldSize100.Text = scanFieldSize;
-            cb_imageresolution.SelectedIndex = 0;
-            InitEvent();
         }
 
         Thread ScanThread = null;
@@ -1086,6 +1053,8 @@ namespace OTSSysMgrApp
             }
         }
 
+
+
         #region 获取元素分析
         private void btnEanalysis_Click(object sender, EventArgs e)
         {
@@ -1186,156 +1155,8 @@ namespace OTSSysMgrApp
 
         #endregion
 
-        private void btn_continuousshot_Click(object sender, EventArgs e)
-        {
-            btn_continuousshot.Enabled = false;
-            btn_confirm.Enabled = false;
-            this.Refresh();
-
-            Graphics g = panel2.CreateGraphics();
-            //g.SmoothingMode = SmoothingMode.HighSpeed;
-            //g.CompositingQuality = CompositingQuality.HighSpeed;
-            g.PixelOffsetMode = PixelOffsetMode.HighQuality;//高质量低速度呈现
-
-            g.SmoothingMode = SmoothingMode.HighQuality;// 指定高质量、低速度呈现。
-            g.InterpolationMode = InterpolationMode.NearestNeighbor;
-
-            ISemController m_Sem = SemController.GetSEMController();
-            bool flag = m_Sem.Connect();
-            //电镜设置对象
-            var cfun = ScanController.GetScanController();
-
-            bool IsConnec = cfun.Init();
-
-            double Magnification = 0;
-            m_Sem.GetMagnification(ref Magnification);
-
-            //double a_dScanFieldSizeX = 0;
-            //double a_dScanFieldSizeY = 0;
-            //m_Sem.GetScanFieldSize(ref a_dScanFieldSizeX,ref a_dScanFieldSizeY);
-
-            double scanFieldSize100 = 0;
-            double.TryParse(tB_scanFieldSize100.Text, out scanFieldSize100);
-            double scanFieldSize = scanFieldSize100 * 100 / Magnification;
-
-            double PositionX = 0;
-            double PositionY = 0;
-            double PositionR = 0;
-            m_Sem.GetSemPositionXY(ref PositionX, ref PositionY, ref PositionR);
-
-            double PositionXO = PositionX;
-            double PositionYO = PositionY;
-            //double PositionR0 = PositionR;
-
-            int width = 1024;
-            int height = 768;
-            //设置图像分辨率
-            if (cb_imageresolution.Text.Trim() == "")
-            {
-                MessageBox.Show("imageresolution cannot be null!");
-                return;
-            }
-            else
-            {
-                width = Convert.ToInt32(cb_imageresolution.Text.Split('*')[0]);
-                height = Convert.ToInt32(cb_imageresolution.Text.Split('*')[1]);
-            }
-
-            this.Refresh();
-
-            double scanFieldSizeH = scanFieldSize * height / width;
-
-            m_Sem.SetScanExternal(true);
-
-            try
-            {
-                for (int i = 0; i < 4; i++)
-                {
-                    if (i == 0)
-                    {
-
-                    }
-                    else if (i == 1)
-                    {
-                        switch (cb_Xdirection.SelectedItem.ToString())
-                        {
-                            case "RIGHT_TOWARD": PositionX += scanFieldSize; break;
-                            default: PositionX -= scanFieldSize; break;
-                        }
-                        m_Sem.MoveSEMToPoint(PositionX, PositionY);
-                    }
-                    else if (i == 2)
-                    {
-                        switch (cb_Ydirection.SelectedItem.ToString())
-                        {
-                            case "UP_TOWARD": PositionY -= scanFieldSizeH; break;
-                            default: PositionY += scanFieldSizeH; break;
-                        }
-                        m_Sem.MoveSEMToPoint(PositionX, PositionY);
-                    }
-                    else
-                    {
-                        switch (cb_Xdirection.SelectedItem.ToString())
-                        {
-                            case "RIGHT_TOWARD": PositionX -= scanFieldSize; break;
-                            default: PositionX += scanFieldSize; break;
-                        }
-                        m_Sem.MoveSEMToPoint(PositionX, PositionY);
-                    }
-                    //Thread.Sleep(50);
-                    byte[] ImageByte = new byte[width * height];
-                    bool resultValue = GetScanImage(width, height, "2", ref ImageByte);
-                    Size size = new Size(panel2.Width / 2, panel2.Height / 2);
-
-                    if (resultValue)
-                    {
-                        if (ImageByte != null)
-                        {
-                            var bitmap = CImageHandler.ToGrayBitmap(ImageByte, width, height);
-                            switch (i)
-                            {
-                                case 0:
-                                    Point point0 = new Point(0,0);
-                                    Rectangle rect0 = new Rectangle(point0,size);
-                                    g.DrawImage(bitmap,rect0);
-                                    break;
-                                case 1:
-                                    Point point1 = new Point(panel2.Width / 2, 0);
-                                    Rectangle rect1 = new Rectangle(point1, size);
-                                    g.DrawImage(bitmap, rect1);
-                                    break;
-                                case 2:
-                                    Point point2 = new Point(panel2.Width/2, panel2.Height / 2);
-                                    Rectangle rect2 = new Rectangle(point2, size);
-                                    g.DrawImage(bitmap, rect2);
-                                    break;
-                                case 3:
-                                    Point point3 = new Point(0, panel2.Height / 2);
-                                    Rectangle rect3 = new Rectangle(point3, size);
-                                    g.DrawImage(bitmap, rect3);
-                                    break;
-                            }
-                            //this.Refresh();
-                        }
-                    }
-                }
-                m_Sem.MoveSEMToPoint(PositionXO, PositionYO);
-            }
-            catch (Exception ex)
-            {
-                log.Error("continuousshot--错误信息:" + ex.ToString());
-            }
-            finally
-            {
-                m_Sem.SetScanExternal(false);
-              
-                btn_continuousshot.Enabled = true;
-                btn_confirm.Enabled = true;
-                btn_continuousshot.Refresh();
 
-                g.Dispose();
-            }
-        }
+        
 
         bool ReadConfigXml(string xmlpath,ref string xAxisDir,ref string yAxisDir,ref string scanFieldSize)
         {
@@ -1394,101 +1215,5 @@ namespace OTSSysMgrApp
             }
             return true;
         }
-
-        private void btn_confirm_Click(object sender, EventArgs e)
-        {
-            double dscanFieldSize100 = 0;
-            if (cb_Xdirection.Text.Trim() != null && cb_imageresolution.Text.Trim() != null && cb_Ydirection.Text.Trim() != null && double.TryParse(tB_scanFieldSize100.Text, out dscanFieldSize100))
-            {
-                string xmlpath = Application.StartupPath + @"\Config\SysData\OTSProgMgrParam.pmf";
-                string xAxisDir = "";
-                string yAxisDir = "";
-                switch (cb_Xdirection.SelectedItem.ToString())
-                {
-                    case "LEFT_TOWARD":
-                        xAxisDir = "0:LEFT_TOWARD";
-                        break;
-                    default:
-                        xAxisDir = "1:RIGHT_TOWARD";
-                        break;
-                }
-                switch(cb_Ydirection.Text)
-                {
-                    case "UP_TOWARD":
-                        yAxisDir="0:" + cb_Ydirection.Text;
-                        break;
-                    default:
-                        yAxisDir = "1:DOWN_TOWARD";
-                        break;
-                }
-                SaveConfigXml(xmlpath, xAxisDir, yAxisDir, tB_scanFieldSize100.Text);
-            }
-            else
-            {
-                MessageBox.Show("Please check params!");
-            }
-        }
-
-        private void btn_Recommendedconfiguration_Click(object sender, EventArgs e)
-        {
-            if (recommendedConfiguration == null || recommendedConfiguration.IsDisposed)
-            {
-                recommendedConfiguration = new RecommendedConfiguration(Language.ReadDefaultLanguage());
-
-                recommendedConfiguration.Show();
-            }
-            else
-            {
-                recommendedConfiguration.Activate();
-            }
-        }
-
-        void DrawFrames()
-        {
-            Graphics g = panel2.CreateGraphics();
-            g.SmoothingMode = SmoothingMode.HighQuality;
-            Pen pen = new Pen(Color.Black);
-            g.DrawLine(pen,new Point(panel2.Width/2,0),new Point(panel2.Width / 2, panel2.Height));
-            g.DrawLine(pen, new Point(0, panel2.Height/2), new Point(panel2.Width, panel2.Height/2));
-
-            pen.Dispose();
-            g.Dispose();
-        }
-
-        private void panel2_Paint(object sender, PaintEventArgs e)
-        {
-            DrawFrames();
-        }
-
-        void InitEvent()
-        {
-            string edsType = FileHelper.GetXMLInformations("EDSName");
-            string SemType = FileHelper.GetXMLInformations("SemControllerName");
-
-            if (SemType == "FEI")
-            {
-                if (edsType == "FEI")
-                {
-                    cb_imageresolution.SelectedIndex = 2;
-
-                }
-                else if (edsType == "Oxford")
-                {
-                    cb_imageresolution.SelectedIndex = 0;
-
-                }
-                else if (edsType == "Bruker")
-                {
-                    cb_imageresolution.SelectedIndex = 1;
-
-                }
-                else if (edsType == "OffLine")
-                {
-                    cb_imageresolution.SelectedIndex = 1;
-                }
-                cb_Xdirection.SelectedIndex = 1;
-                cb_Ydirection.SelectedIndex = 0;
-            }
-        }
     }
 }

+ 13 - 5
OTSSysMgrApp/OTSSysMgrApp.csproj

@@ -209,6 +209,10 @@
       <HintPath>..\OpenDll\Nlog\NLog.dll</HintPath>
       <Private>False</Private>
     </Reference>
+    <Reference Include="OTSMeasureApp, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\Bin\x64\Debug\OTSMeasureApp.exe</HintPath>
+    </Reference>
     <Reference Include="OxfordExtenderWrapper, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\Bin\x64\Release_oxford61\OxfordExtender\OxfordExtenderWrapper.exe</HintPath>
@@ -276,6 +280,12 @@
     <Compile Include="ShowXRayElementResultForm.Designer.cs">
       <DependentUpon>ShowXRayElementResultForm.cs</DependentUpon>
     </Compile>
+    <Compile Include="StageTest.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="StageTest.Designer.cs">
+      <DependentUpon>StageTest.cs</DependentUpon>
+    </Compile>
     <Compile Include="SwitchSystemValidation.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -306,6 +316,9 @@
     <EmbeddedResource Include="ShowXRayElementResultForm.resx">
       <DependentUpon>ShowXRayElementResultForm.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="StageTest.resx">
+      <DependentUpon>StageTest.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="SwitchSystemValidation.resx">
       <DependentUpon>SwitchSystemValidation.cs</DependentUpon>
     </EmbeddedResource>
@@ -352,11 +365,6 @@
       <Name>OTSClrInterface</Name>
       <Private>False</Private>
     </ProjectReference>
-    <ProjectReference Include="..\OTSIncAMeasureApp\OTSIncAMeasureApp.csproj">
-      <Project>{474772DC-334A-4E87-BB46-3ABD913AA44A}</Project>
-      <Name>OTSIncAMeasureApp</Name>
-      <Private>False</Private>
-    </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 17 - 2
OTSSysMgrApp/OTSSystemManagerForms.Designer.cs

@@ -35,6 +35,7 @@
             this.rdb_ch = new System.Windows.Forms.RadioButton();
             this.tabControl1 = new System.Windows.Forms.TabControl();
             this.tabHardwareSet = new System.Windows.Forms.TabPage();
+            this.btn_stagetest = new System.Windows.Forms.Button();
             this.CmbEDSController = new System.Windows.Forms.ComboBox();
             this.btnEDSTest = new System.Windows.Forms.Button();
             this.btnSEMTest = new System.Windows.Forms.Button();
@@ -127,6 +128,7 @@
             // 
             // tabHardwareSet
             // 
+            this.tabHardwareSet.Controls.Add(this.btn_stagetest);
             this.tabHardwareSet.Controls.Add(this.CmbEDSController);
             this.tabHardwareSet.Controls.Add(this.btnEDSTest);
             this.tabHardwareSet.Controls.Add(this.btnSEMTest);
@@ -143,6 +145,18 @@
             this.tabHardwareSet.Text = "硬件";
             this.tabHardwareSet.UseVisualStyleBackColor = true;
             // 
+            // btn_stagetest
+            // 
+            this.btn_stagetest.AutoEllipsis = true;
+            this.btn_stagetest.Location = new System.Drawing.Point(334, 66);
+            this.btn_stagetest.Margin = new System.Windows.Forms.Padding(2);
+            this.btn_stagetest.Name = "btn_stagetest";
+            this.btn_stagetest.Size = new System.Drawing.Size(77, 24);
+            this.btn_stagetest.TabIndex = 15;
+            this.btn_stagetest.Text = "轴方向测试";
+            this.btn_stagetest.UseVisualStyleBackColor = true;
+            this.btn_stagetest.Click += new System.EventHandler(this.btn_stagetest_Click);
+            // 
             // CmbEDSController
             // 
             this.CmbEDSController.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@@ -161,7 +175,7 @@
             // 
             // btnEDSTest
             // 
-            this.btnEDSTest.Location = new System.Drawing.Point(334, 71);
+            this.btnEDSTest.Location = new System.Drawing.Point(241, 66);
             this.btnEDSTest.Margin = new System.Windows.Forms.Padding(2);
             this.btnEDSTest.Name = "btnEDSTest";
             this.btnEDSTest.Size = new System.Drawing.Size(77, 24);
@@ -172,7 +186,7 @@
             // 
             // btnSEMTest
             // 
-            this.btnSEMTest.Location = new System.Drawing.Point(218, 71);
+            this.btnSEMTest.Location = new System.Drawing.Point(144, 66);
             this.btnSEMTest.Margin = new System.Windows.Forms.Padding(2);
             this.btnSEMTest.Name = "btnSEMTest";
             this.btnSEMTest.Size = new System.Drawing.Size(77, 24);
@@ -369,5 +383,6 @@
         private System.Windows.Forms.PictureBox pictureBox1;
         private System.Windows.Forms.Button btn_otherconfig;
         private System.Windows.Forms.PictureBox pictureBox4;
+        private System.Windows.Forms.Button btn_stagetest;
     }
 }

+ 13 - 0
OTSSysMgrApp/OTSSystemManagerForms.cs

@@ -697,5 +697,18 @@ namespace OTSSysMgrApp
                 MessageBox.Show("File is lost!");
             }
         }
+
+        private void btn_stagetest_Click(object sender, EventArgs e)
+        {
+            StageTest sTextForms = new StageTest();
+            try
+            {
+                sTextForms.Show();
+            }
+            catch (InvalidOperationException ex)
+            {
+                log.Error("OTSSystemManagerForms_btnEDSTest_Click-错误日志:" + ex.ToString());
+            }
+        }
     }
 }

+ 6 - 6
OTSSysMgrApp/OTSSystemManagerForms.resx

@@ -165,7 +165,7 @@
         RudN65tdA8sHzg46DF645Xrr8m2v29fvrLwzMBQydHc4cnjkLvvu5L2key/vZ9yff7DpIfph4SOpR+WP
         lR7X/aj3Y+uI5ciZUdfRvidBTx6Mscae/5T+04fx/Kfkp+UTqhONk2aTp6fcp24+W/1s/Hnq8/npgp+l
         f65+ofviu18cf+mbWTUz/pL/cuHX4lfyr468Xva6e9Z/9vGb5Dfzc4Vv5d8efcd41/s+7P3EfOYH7IeK
-        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALDgAACw4BQL7hQQAAGd5JREFUeF7tnIl3m9WZ
+        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALDAAACwwBP0AiyAAAGd5JREFUeF7tnIl3m9WZ
         xilJHG+yJUu2JVn7vu+7bK3WbmuxtXlN7OwbZA9JICRAtgkhQHZCICQtCUlpyWK7MKcwQ4GWc+ZMKe3Q
         QgvJnzKP/EFKbw+BLLY6gznP+bjv910t3y/P+9732pIfeujGrTn9UJHxnO4gMp7THUTGc7qDyHhOdxAZ
         V1WMqZu8qS/bpr4izv+riIyrJMnUX+Pb98c27F6+ekNi9/PJp49qJ/9CzKm+yLhKipz/ldZgyfSVlRqT
@@ -279,7 +279,7 @@
         yHhO36Ubt/4X1wSr+KCdTCMAAAAASUVORK5CYII=
 </value>
   </data>
-  <data name="pictureBox4.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+  <data name="pictureBox2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
         DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp
@@ -326,7 +326,7 @@
         RudN65tdA8sHzg46DF645Xrr8m2v29fvrLwzMBQydHc4cnjkLvvu5L2key/vZ9yff7DpIfph4SOpR+WP
         lR7X/aj3Y+uI5ciZUdfRvidBTx6Mscae/5T+04fx/Kfkp+UTqhONk2aTp6fcp24+W/1s/Hnq8/npgp+l
         f65+ofviu18cf+mbWTUz/pL/cuHX4lfyr468Xva6e9Z/9vGb5Dfzc4Vv5d8efcd41/s+7P3EfOYH7IeK
-        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALDgAACw4BQL7hQQAAGd5JREFUeF7tnIl3m9WZ
+        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALDAAACwwBP0AiyAAAGd5JREFUeF7tnIl3m9WZ
         xilJHG+yJUu2JVn7vu+7bK3WbmuxtXlN7OwbZA9JICRAtgkhQHZCICQtCUlpyWK7MKcwQ4GWc+ZMKe3Q
         QgvJnzKP/EFKbw+BLLY6gznP+bjv910t3y/P+9732pIfeujGrTn9UJHxnO4gMp7THUTGc7qDyHhOdxAZ
         V1WMqZu8qS/bpr4izv+riIyrJMnUX+Pb98c27F6+ekNi9/PJp49qJ/9CzKm+yLhKipz/ldZgyfSVlRqT
@@ -440,7 +440,7 @@
         yHhO36Ubt/4X1wSr+KCdTCMAAAAASUVORK5CYII=
 </value>
   </data>
-  <data name="pictureBox2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+  <data name="pictureBox4.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
         DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp
@@ -487,7 +487,7 @@
         RudN65tdA8sHzg46DF645Xrr8m2v29fvrLwzMBQydHc4cnjkLvvu5L2key/vZ9yff7DpIfph4SOpR+WP
         lR7X/aj3Y+uI5ciZUdfRvidBTx6Mscae/5T+04fx/Kfkp+UTqhONk2aTp6fcp24+W/1s/Hnq8/npgp+l
         f65+ofviu18cf+mbWTUz/pL/cuHX4lfyr468Xva6e9Z/9vGb5Dfzc4Vv5d8efcd41/s+7P3EfOYH7IeK
-        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALDgAACw4BQL7hQQAAGd5JREFUeF7tnIl3m9WZ
+        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALDAAACwwBP0AiyAAAGd5JREFUeF7tnIl3m9WZ
         xilJHG+yJUu2JVn7vu+7bK3WbmuxtXlN7OwbZA9JICRAtgkhQHZCICQtCUlpyWK7MKcwQ4GWc+ZMKe3Q
         QgvJnzKP/EFKbw+BLLY6gznP+bjv910t3y/P+9732pIfeujGrTn9UJHxnO4gMp7THUTGc7qDyHhOdxAZ
         V1WMqZu8qS/bpr4izv+riIyrJMnUX+Pb98c27F6+ekNi9/PJp49qJ/9CzKm+yLhKipz/ldZgyfSVlRqT
@@ -648,7 +648,7 @@
         RudN65tdA8sHzg46DF645Xrr8m2v29fvrLwzMBQydHc4cnjkLvvu5L2key/vZ9yff7DpIfph4SOpR+WP
         lR7X/aj3Y+uI5ciZUdfRvidBTx6Mscae/5T+04fx/Kfkp+UTqhONk2aTp6fcp24+W/1s/Hnq8/npgp+l
         f65+ofviu18cf+mbWTUz/pL/cuHX4lfyr468Xva6e9Z/9vGb5Dfzc4Vv5d8efcd41/s+7P3EfOYH7IeK
-        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALDgAACw4BQL7hQQAAGd5JREFUeF7tnIl3m9WZ
+        j3ofuz55f3q4kLyw8Bv3hPP74uYdwgAAAAlwSFlzAAALDAAACwwBP0AiyAAAGd5JREFUeF7tnIl3m9WZ
         xilJHG+yJUu2JVn7vu+7bK3WbmuxtXlN7OwbZA9JICRAtgkhQHZCICQtCUlpyWK7MKcwQ4GWc+ZMKe3Q
         QgvJnzKP/EFKbw+BLLY6gznP+bjv910t3y/P+9732pIfeujGrTn9UJHxnO4gMp7THUTGc7qDyHhOdxAZ
         V1WMqZu8qS/bpr4izv+riIyrJMnUX+Pb98c27F6+ekNi9/PJp49qJ/9CzKm+yLhKipz/ldZgyfSVlRqT

+ 13 - 13
OTSSysMgrApp/SemTestForms.cs

@@ -524,26 +524,26 @@ namespace OTSSysMgrApp
                     this.Focus();
                     return;
                 }
-                //if (!IsNull(tbSPositionR))
-                //{
-                //    this.Focus();
-                //    return;
-                //}
-                //if (!IsType(tbSPositionR.Text, 2))
-                //{
-                //    this.Focus();
-                //    return;
-                //}
+                if (!IsNull(tbSPositionR))
+                {
+                    this.Focus();
+                    return;
+                }
+                if (!IsType(tbSPositionR.Text, 2))
+                {
+                    this.Focus();
+                    return;
+                }
                 //赋值
                 double PositionX = Convert.ToDouble(tbSPositionX.Text);
                 double PositionY = Convert.ToDouble(tbSPositionY.Text);
-                //double PositionR = Convert.ToDouble(tbSPositionR.Text);
-                bool result = m_SemHardwareMgr.MoveSEMToPoint(PositionX, PositionY);
+                double PositionR = Convert.ToDouble(tbSPositionR.Text);
+                bool result = m_SemHardwareMgr.MoveSEMToPoint(PositionX, PositionY, PositionR);
                 if (result)
                 {
                     //配置结果提示
                     ShowMessage(3);
-                    log.Info("Set successfully, current X and Y coordinates should be:(" + PositionX.ToString() + "," + PositionY.ToString() + ")");
+                    log.Info("Set successfully, current X and Y coordinates should be:(" + PositionX.ToString() + "," + PositionY.ToString() + "," + PositionR.ToString() + ")");
                 }
                 else
                 {

+ 534 - 0
OTSSysMgrApp/StageTest.Designer.cs

@@ -0,0 +1,534 @@
+namespace OTSSysMgrApp
+{
+    partial class StageTest
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+            this.btn_Recommendedconfiguration = new System.Windows.Forms.Button();
+            this.label5 = new System.Windows.Forms.Label();
+            this.cb_imageresolution = new System.Windows.Forms.ComboBox();
+            this.label4 = new System.Windows.Forms.Label();
+            this.label3 = new System.Windows.Forms.Label();
+            this.tB_scanFieldSize100 = new System.Windows.Forms.TextBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.btn_confirm = new System.Windows.Forms.Button();
+            this.cb_Ydirection = new System.Windows.Forms.ComboBox();
+            this.label_y = new System.Windows.Forms.Label();
+            this.cb_Xdirection = new System.Windows.Forms.ComboBox();
+            this.label_x = new System.Windows.Forms.Label();
+            this.btn_continuousshot = new System.Windows.Forms.Button();
+            this.panel2 = new System.Windows.Forms.Panel();
+            this.panelblank = new System.Windows.Forms.Panel();
+            this.panel4 = new System.Windows.Forms.Panel();
+            this.label16 = new System.Windows.Forms.Label();
+            this.tbSPositionR = new System.Windows.Forms.TextBox();
+            this.tbSPositionY = new System.Windows.Forms.TextBox();
+            this.tbSPositionX = new System.Windows.Forms.TextBox();
+            this.label2 = new System.Windows.Forms.Label();
+            this.label6 = new System.Windows.Forms.Label();
+            this.btn_setpositionxyr = new System.Windows.Forms.Button();
+            this.label10 = new System.Windows.Forms.Label();
+            this.panel3 = new System.Windows.Forms.Panel();
+            this.label17 = new System.Windows.Forms.Label();
+            this.label8 = new System.Windows.Forms.Label();
+            this.btnGPositionXYR = new System.Windows.Forms.Button();
+            this.tbPositionX = new System.Windows.Forms.TextBox();
+            this.tbPositionR = new System.Windows.Forms.TextBox();
+            this.lblGPositionX = new System.Windows.Forms.Label();
+            this.tbPositionY = new System.Windows.Forms.TextBox();
+            this.lblGPositionY = new System.Windows.Forms.Label();
+            this.label7 = new System.Windows.Forms.Label();
+            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+            this.splitContainer1.Panel1.SuspendLayout();
+            this.splitContainer1.Panel2.SuspendLayout();
+            this.splitContainer1.SuspendLayout();
+            this.panelblank.SuspendLayout();
+            this.panel4.SuspendLayout();
+            this.panel3.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // splitContainer1
+            // 
+            this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.splitContainer1.Location = new System.Drawing.Point(1, 1);
+            this.splitContainer1.Name = "splitContainer1";
+            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
+            // 
+            // splitContainer1.Panel1
+            // 
+            this.splitContainer1.Panel1.Controls.Add(this.btn_Recommendedconfiguration);
+            this.splitContainer1.Panel1.Controls.Add(this.label5);
+            this.splitContainer1.Panel1.Controls.Add(this.cb_imageresolution);
+            this.splitContainer1.Panel1.Controls.Add(this.label4);
+            this.splitContainer1.Panel1.Controls.Add(this.label3);
+            this.splitContainer1.Panel1.Controls.Add(this.tB_scanFieldSize100);
+            this.splitContainer1.Panel1.Controls.Add(this.label1);
+            this.splitContainer1.Panel1.Controls.Add(this.btn_confirm);
+            this.splitContainer1.Panel1.Controls.Add(this.cb_Ydirection);
+            this.splitContainer1.Panel1.Controls.Add(this.label_y);
+            this.splitContainer1.Panel1.Controls.Add(this.cb_Xdirection);
+            this.splitContainer1.Panel1.Controls.Add(this.label_x);
+            this.splitContainer1.Panel1.Controls.Add(this.btn_continuousshot);
+            // 
+            // splitContainer1.Panel2
+            // 
+            this.splitContainer1.Panel2.Controls.Add(this.panel2);
+            this.splitContainer1.Size = new System.Drawing.Size(1034, 753);
+            this.splitContainer1.SplitterDistance = 87;
+            this.splitContainer1.TabIndex = 3;
+            // 
+            // btn_Recommendedconfiguration
+            // 
+            this.btn_Recommendedconfiguration.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+            this.btn_Recommendedconfiguration.Location = new System.Drawing.Point(267, 45);
+            this.btn_Recommendedconfiguration.Name = "btn_Recommendedconfiguration";
+            this.btn_Recommendedconfiguration.Size = new System.Drawing.Size(75, 23);
+            this.btn_Recommendedconfiguration.TabIndex = 29;
+            this.btn_Recommendedconfiguration.Text = "推荐配置";
+            this.btn_Recommendedconfiguration.UseVisualStyleBackColor = true;
+            this.btn_Recommendedconfiguration.Click += new System.EventHandler(this.btn_Recommendedconfiguration_Click);
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Location = new System.Drawing.Point(399, 52);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(131, 12);
+            this.label5.TabIndex = 28;
+            this.label5.Text = "请在 100 放大倍数调试";
+            // 
+            // cb_imageresolution
+            // 
+            this.cb_imageresolution.FormattingEnabled = true;
+            this.cb_imageresolution.Location = new System.Drawing.Point(74, 49);
+            this.cb_imageresolution.Name = "cb_imageresolution";
+            this.cb_imageresolution.Size = new System.Drawing.Size(121, 20);
+            this.cb_imageresolution.TabIndex = 27;
+            // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.Location = new System.Drawing.Point(15, 52);
+            this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(47, 12);
+            this.label4.TabIndex = 26;
+            this.label4.Text = "分辨率:";
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(605, 15);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(17, 12);
+            this.label3.TabIndex = 25;
+            this.label3.Text = "um";
+            // 
+            // tB_scanFieldSize100
+            // 
+            this.tB_scanFieldSize100.Location = new System.Drawing.Point(499, 11);
+            this.tB_scanFieldSize100.Name = "tB_scanFieldSize100";
+            this.tB_scanFieldSize100.Size = new System.Drawing.Size(100, 21);
+            this.tB_scanFieldSize100.TabIndex = 24;
+            this.tB_scanFieldSize100.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(399, 15);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(107, 12);
+            this.label1.TabIndex = 23;
+            this.label1.Text = "100倍下屏幕宽度:";
+            // 
+            // btn_confirm
+            // 
+            this.btn_confirm.Location = new System.Drawing.Point(835, 16);
+            this.btn_confirm.Name = "btn_confirm";
+            this.btn_confirm.Size = new System.Drawing.Size(75, 61);
+            this.btn_confirm.TabIndex = 22;
+            this.btn_confirm.Text = "保存";
+            this.btn_confirm.UseVisualStyleBackColor = true;
+            this.btn_confirm.Click += new System.EventHandler(this.btn_confirm_Click);
+            // 
+            // cb_Ydirection
+            // 
+            this.cb_Ydirection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.cb_Ydirection.FormattingEnabled = true;
+            this.cb_Ydirection.Location = new System.Drawing.Point(267, 11);
+            this.cb_Ydirection.Name = "cb_Ydirection";
+            this.cb_Ydirection.Size = new System.Drawing.Size(119, 20);
+            this.cb_Ydirection.TabIndex = 21;
+            // 
+            // label_y
+            // 
+            this.label_y.AutoSize = true;
+            this.label_y.Location = new System.Drawing.Point(201, 15);
+            this.label_y.Name = "label_y";
+            this.label_y.Size = new System.Drawing.Size(71, 12);
+            this.label_y.TabIndex = 20;
+            this.label_y.Text = "y轴正方向:";
+            // 
+            // cb_Xdirection
+            // 
+            this.cb_Xdirection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.cb_Xdirection.FormattingEnabled = true;
+            this.cb_Xdirection.Location = new System.Drawing.Point(76, 12);
+            this.cb_Xdirection.Name = "cb_Xdirection";
+            this.cb_Xdirection.Size = new System.Drawing.Size(119, 20);
+            this.cb_Xdirection.TabIndex = 19;
+            // 
+            // label_x
+            // 
+            this.label_x.AutoSize = true;
+            this.label_x.Location = new System.Drawing.Point(11, 15);
+            this.label_x.Name = "label_x";
+            this.label_x.Size = new System.Drawing.Size(71, 12);
+            this.label_x.TabIndex = 18;
+            this.label_x.Text = "x轴正方向:";
+            // 
+            // btn_continuousshot
+            // 
+            this.btn_continuousshot.Location = new System.Drawing.Point(657, 15);
+            this.btn_continuousshot.Name = "btn_continuousshot";
+            this.btn_continuousshot.Size = new System.Drawing.Size(163, 61);
+            this.btn_continuousshot.TabIndex = 17;
+            this.btn_continuousshot.Text = "轴方向验证";
+            this.btn_continuousshot.UseVisualStyleBackColor = true;
+            this.btn_continuousshot.Click += new System.EventHandler(this.btn_continuousshot_Click);
+            // 
+            // panel2
+            // 
+            this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.panel2.Location = new System.Drawing.Point(4, 3);
+            this.panel2.Name = "panel2";
+            this.panel2.Size = new System.Drawing.Size(1029, 656);
+            this.panel2.TabIndex = 3;
+            // 
+            // panelblank
+            // 
+            this.panelblank.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.panelblank.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.panelblank.Controls.Add(this.panel4);
+            this.panelblank.Controls.Add(this.panel3);
+            this.panelblank.Controls.Add(this.label7);
+            this.panelblank.Location = new System.Drawing.Point(1041, 1);
+            this.panelblank.Name = "panelblank";
+            this.panelblank.Size = new System.Drawing.Size(347, 753);
+            this.panelblank.TabIndex = 4;
+            // 
+            // panel4
+            // 
+            this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.panel4.Controls.Add(this.label16);
+            this.panel4.Controls.Add(this.tbSPositionR);
+            this.panel4.Controls.Add(this.tbSPositionY);
+            this.panel4.Controls.Add(this.tbSPositionX);
+            this.panel4.Controls.Add(this.label2);
+            this.panel4.Controls.Add(this.label6);
+            this.panel4.Controls.Add(this.btn_setpositionxyr);
+            this.panel4.Controls.Add(this.label10);
+            this.panel4.Location = new System.Drawing.Point(0, 251);
+            this.panel4.Name = "panel4";
+            this.panel4.Size = new System.Drawing.Size(344, 225);
+            this.panel4.TabIndex = 2;
+            // 
+            // label16
+            // 
+            this.label16.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.label16.AutoSize = true;
+            this.label16.Location = new System.Drawing.Point(66, 135);
+            this.label16.Name = "label16";
+            this.label16.Size = new System.Drawing.Size(23, 12);
+            this.label16.TabIndex = 61;
+            this.label16.Text = "R轴";
+            // 
+            // tbSPositionR
+            // 
+            this.tbSPositionR.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.tbSPositionR.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.tbSPositionR.Location = new System.Drawing.Point(126, 130);
+            this.tbSPositionR.Margin = new System.Windows.Forms.Padding(2);
+            this.tbSPositionR.Name = "tbSPositionR";
+            this.tbSPositionR.Size = new System.Drawing.Size(131, 23);
+            this.tbSPositionR.TabIndex = 60;
+            // 
+            // tbSPositionY
+            // 
+            this.tbSPositionY.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.tbSPositionY.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.tbSPositionY.Location = new System.Drawing.Point(126, 88);
+            this.tbSPositionY.Margin = new System.Windows.Forms.Padding(2);
+            this.tbSPositionY.Name = "tbSPositionY";
+            this.tbSPositionY.Size = new System.Drawing.Size(131, 23);
+            this.tbSPositionY.TabIndex = 59;
+            // 
+            // tbSPositionX
+            // 
+            this.tbSPositionX.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.tbSPositionX.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.tbSPositionX.Location = new System.Drawing.Point(126, 43);
+            this.tbSPositionX.Margin = new System.Windows.Forms.Padding(2);
+            this.tbSPositionX.Name = "tbSPositionX";
+            this.tbSPositionX.Size = new System.Drawing.Size(131, 23);
+            this.tbSPositionX.TabIndex = 58;
+            // 
+            // label2
+            // 
+            this.label2.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(66, 52);
+            this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(23, 12);
+            this.label2.TabIndex = 56;
+            this.label2.Text = "X轴";
+            // 
+            // label6
+            // 
+            this.label6.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.label6.AutoSize = true;
+            this.label6.Location = new System.Drawing.Point(66, 93);
+            this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(23, 12);
+            this.label6.TabIndex = 57;
+            this.label6.Text = "Y轴";
+            // 
+            // btn_setpositionxyr
+            // 
+            this.btn_setpositionxyr.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.btn_setpositionxyr.Location = new System.Drawing.Point(241, 181);
+            this.btn_setpositionxyr.Margin = new System.Windows.Forms.Padding(2);
+            this.btn_setpositionxyr.Name = "btn_setpositionxyr";
+            this.btn_setpositionxyr.Size = new System.Drawing.Size(99, 29);
+            this.btn_setpositionxyr.TabIndex = 55;
+            this.btn_setpositionxyr.Text = "设置";
+            this.btn_setpositionxyr.UseVisualStyleBackColor = true;
+            this.btn_setpositionxyr.Click += new System.EventHandler(this.btn_setpositionxyr_Click);
+            // 
+            // label10
+            // 
+            this.label10.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.label10.AutoSize = true;
+            this.label10.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label10.Location = new System.Drawing.Point(3, 8);
+            this.label10.Name = "label10";
+            this.label10.Size = new System.Drawing.Size(51, 20);
+            this.label10.TabIndex = 0;
+            this.label10.Text = "写入";
+            // 
+            // panel3
+            // 
+            this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.panel3.Controls.Add(this.label17);
+            this.panel3.Controls.Add(this.label8);
+            this.panel3.Controls.Add(this.btnGPositionXYR);
+            this.panel3.Controls.Add(this.tbPositionX);
+            this.panel3.Controls.Add(this.tbPositionR);
+            this.panel3.Controls.Add(this.lblGPositionX);
+            this.panel3.Controls.Add(this.tbPositionY);
+            this.panel3.Controls.Add(this.lblGPositionY);
+            this.panel3.Location = new System.Drawing.Point(0, 19);
+            this.panel3.Name = "panel3";
+            this.panel3.Size = new System.Drawing.Size(344, 226);
+            this.panel3.TabIndex = 1;
+            // 
+            // label17
+            // 
+            this.label17.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.label17.AutoSize = true;
+            this.label17.Location = new System.Drawing.Point(66, 144);
+            this.label17.Name = "label17";
+            this.label17.Size = new System.Drawing.Size(23, 12);
+            this.label17.TabIndex = 54;
+            this.label17.Text = "R轴";
+            // 
+            // label8
+            // 
+            this.label8.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.label8.AutoSize = true;
+            this.label8.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label8.Location = new System.Drawing.Point(3, 8);
+            this.label8.Name = "label8";
+            this.label8.Size = new System.Drawing.Size(51, 20);
+            this.label8.TabIndex = 0;
+            this.label8.Text = "读取";
+            // 
+            // btnGPositionXYR
+            // 
+            this.btnGPositionXYR.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.btnGPositionXYR.Location = new System.Drawing.Point(241, 184);
+            this.btnGPositionXYR.Margin = new System.Windows.Forms.Padding(2);
+            this.btnGPositionXYR.Name = "btnGPositionXYR";
+            this.btnGPositionXYR.Size = new System.Drawing.Size(99, 29);
+            this.btnGPositionXYR.TabIndex = 53;
+            this.btnGPositionXYR.Text = "获取";
+            this.btnGPositionXYR.UseVisualStyleBackColor = true;
+            this.btnGPositionXYR.Click += new System.EventHandler(this.btnGPositionXYR_Click);
+            // 
+            // tbPositionX
+            // 
+            this.tbPositionX.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.tbPositionX.Enabled = false;
+            this.tbPositionX.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.tbPositionX.Location = new System.Drawing.Point(126, 47);
+            this.tbPositionX.Margin = new System.Windows.Forms.Padding(2);
+            this.tbPositionX.Name = "tbPositionX";
+            this.tbPositionX.ReadOnly = true;
+            this.tbPositionX.Size = new System.Drawing.Size(131, 23);
+            this.tbPositionX.TabIndex = 52;
+            // 
+            // tbPositionR
+            // 
+            this.tbPositionR.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.tbPositionR.Enabled = false;
+            this.tbPositionR.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.tbPositionR.Location = new System.Drawing.Point(126, 139);
+            this.tbPositionR.Margin = new System.Windows.Forms.Padding(2);
+            this.tbPositionR.Name = "tbPositionR";
+            this.tbPositionR.ReadOnly = true;
+            this.tbPositionR.Size = new System.Drawing.Size(131, 23);
+            this.tbPositionR.TabIndex = 50;
+            // 
+            // lblGPositionX
+            // 
+            this.lblGPositionX.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.lblGPositionX.AutoSize = true;
+            this.lblGPositionX.Location = new System.Drawing.Point(66, 52);
+            this.lblGPositionX.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.lblGPositionX.Name = "lblGPositionX";
+            this.lblGPositionX.Size = new System.Drawing.Size(23, 12);
+            this.lblGPositionX.TabIndex = 49;
+            this.lblGPositionX.Text = "X轴";
+            // 
+            // tbPositionY
+            // 
+            this.tbPositionY.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.tbPositionY.Enabled = false;
+            this.tbPositionY.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.tbPositionY.Location = new System.Drawing.Point(126, 93);
+            this.tbPositionY.Margin = new System.Windows.Forms.Padding(2);
+            this.tbPositionY.Name = "tbPositionY";
+            this.tbPositionY.ReadOnly = true;
+            this.tbPositionY.Size = new System.Drawing.Size(131, 23);
+            this.tbPositionY.TabIndex = 51;
+            // 
+            // lblGPositionY
+            // 
+            this.lblGPositionY.Anchor = System.Windows.Forms.AnchorStyles.Right;
+            this.lblGPositionY.AutoSize = true;
+            this.lblGPositionY.Location = new System.Drawing.Point(66, 98);
+            this.lblGPositionY.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.lblGPositionY.Name = "lblGPositionY";
+            this.lblGPositionY.Size = new System.Drawing.Size(23, 12);
+            this.lblGPositionY.TabIndex = 48;
+            this.lblGPositionY.Text = "Y轴";
+            // 
+            // label7
+            // 
+            this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.label7.AutoSize = true;
+            this.label7.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label7.Location = new System.Drawing.Point(2, 4);
+            this.label7.Name = "label7";
+            this.label7.Size = new System.Drawing.Size(161, 12);
+            this.label7.TabIndex = 0;
+            this.label7.Text = "样品台位置读取与测试测试";
+            // 
+            // StageTest
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(1392, 755);
+            this.Controls.Add(this.panelblank);
+            this.Controls.Add(this.splitContainer1);
+            this.Name = "StageTest";
+            this.ShowIcon = false;
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+            this.Text = "样品台测试";
+            this.Load += new System.EventHandler(this.StageTest_Load);
+            this.splitContainer1.Panel1.ResumeLayout(false);
+            this.splitContainer1.Panel1.PerformLayout();
+            this.splitContainer1.Panel2.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+            this.splitContainer1.ResumeLayout(false);
+            this.panelblank.ResumeLayout(false);
+            this.panelblank.PerformLayout();
+            this.panel4.ResumeLayout(false);
+            this.panel4.PerformLayout();
+            this.panel3.ResumeLayout(false);
+            this.panel3.PerformLayout();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+        private System.Windows.Forms.SplitContainer splitContainer1;
+        private System.Windows.Forms.Panel panelblank;
+        private System.Windows.Forms.Label label7;
+        private System.Windows.Forms.Panel panel3;
+        private System.Windows.Forms.Label label8;
+        private System.Windows.Forms.Label label17;
+        private System.Windows.Forms.Button btnGPositionXYR;
+        private System.Windows.Forms.TextBox tbPositionX;
+        private System.Windows.Forms.TextBox tbPositionR;
+        private System.Windows.Forms.Label lblGPositionX;
+        private System.Windows.Forms.TextBox tbPositionY;
+        private System.Windows.Forms.Label lblGPositionY;
+        private System.Windows.Forms.Panel panel4;
+        private System.Windows.Forms.Label label10;
+        private System.Windows.Forms.Button btn_setpositionxyr;
+        private System.Windows.Forms.Button btn_Recommendedconfiguration;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.ComboBox cb_imageresolution;
+        private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.TextBox tB_scanFieldSize100;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Button btn_confirm;
+        private System.Windows.Forms.ComboBox cb_Ydirection;
+        private System.Windows.Forms.Label label_y;
+        private System.Windows.Forms.ComboBox cb_Xdirection;
+        private System.Windows.Forms.Label label_x;
+        private System.Windows.Forms.Button btn_continuousshot;
+        private System.Windows.Forms.Panel panel2;
+        private System.Windows.Forms.Label label16;
+        private System.Windows.Forms.TextBox tbSPositionR;
+        private System.Windows.Forms.TextBox tbSPositionY;
+        private System.Windows.Forms.TextBox tbSPositionX;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.Label label6;
+    }
+}

+ 691 - 0
OTSSysMgrApp/StageTest.cs

@@ -0,0 +1,691 @@
+using NLog.Fluent;
+using OTSCLRINTERFACE;
+using OTSModelSharp.ServiceCenter;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Xml;
+
+
+namespace OTSSysMgrApp
+{
+    public partial class StageTest : Form
+    {
+
+        #region 全部变量声明
+        RecommendedConfiguration recommendedConfiguration;
+        //连接状态
+        bool ConnectionState = false;
+
+        static string xmlFilePath = System.Configuration.ConfigurationManager.ConnectionStrings["XMLFilePath"].ConnectionString;
+        static string LogPath = System.Configuration.ConfigurationManager.ConnectionStrings["LogPath"].ConnectionString;
+        static NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
+        ISemController m_SemHardwareMgr = null;
+        IEDSController m_EDSHardwareMgr = null;
+        //图片
+        Bitmap bitmap = null;
+        //国际化
+        Language lan;
+        //国际化存储信息
+        Hashtable table;
+        public enum connectionEnumType
+        {
+            EDSOnlyPointXRay = 0,
+            EDSMultiPointXRay = 1,
+            EDSAreaXRay = 2,
+            ScanImage = 3
+        }
+
+        #endregion
+        public StageTest()
+        {
+            InitializeComponent();
+            m_EDSHardwareMgr = EDSController.GetEDSController(1024, 768, 5000, true, "");
+            m_SemHardwareMgr = SemController.GetSEMController();
+            lan = new Language(this);
+            table = lan.GetNameTable(this.Name);
+
+            if (!ConnectionState)
+            {
+                //和电镜建立通讯连接
+                ConnectionState = m_SemHardwareMgr.Connect();
+                ///获取当前电镜的ID号
+                //SemType = cfun.GetSemType();
+
+                if (!ConnectionState)
+                {
+                    log.Error(table["message3"].ToString());
+                }
+                else
+                {
+                    string str = table["str1"].ToString();
+                    log.Info("The energy spectrum is connected");
+                }
+            }
+            else
+            {
+                string str = table["str2"].ToString();
+                ConnectionState = false;
+            }
+        }
+
+        private void btnGPositionXYR_Click(object sender, EventArgs e)
+        {
+            try
+            {
+                //赋值
+                double PositionX = 0;
+                double PositionY = 0;
+                double PositionR = 0;
+                //获取参数
+                bool result = m_SemHardwareMgr.GetSemPositionXY(ref PositionX, ref PositionY, ref PositionR);
+                if (result)
+                {
+                    //赋值 显示
+                    tbPositionX.Text = Convert.ToDouble(PositionX).ToString();
+                    tbPositionY.Text = Convert.ToDouble(PositionY).ToString();
+                    tbPositionR.Text = Convert.ToDouble(PositionR).ToString();
+                    log.Info("X,Y-axis coordinates:(" + tbPositionX.Text + "," + tbPositionY.Text + ")");
+                }
+                else
+                {
+                    //配置结果提示
+                    ShowMessage(6);
+                    log.Error("Failed to obtain the X and Y coordinates");
+                }
+            }
+            catch (Exception ex)
+            {
+                //记录日志信息(异常日志)
+                log.Error(ex.Message.ToString());
+            }
+        }
+        private void btn_setpositionxyr_Click(object sender, EventArgs e)
+        {
+            try
+            {
+                if (!IsNull(tbSPositionX))
+                {
+                    this.Focus();
+                    return;
+                }
+                if (!IsType(tbSPositionX.Text, 2))
+                {
+                    this.Focus();
+                    return;
+                }
+                if (!IsNull(tbSPositionY))
+                {
+                    this.Focus();
+                    return;
+                }
+                if (!IsType(tbSPositionY.Text, 2))
+                {
+                    this.Focus();
+                    return;
+                }
+                if (!IsNull(tbSPositionR))
+                {
+                    this.Focus();
+                    return;
+                }
+                if (!IsType(tbSPositionR.Text, 2))
+                {
+                    this.Focus();
+                    return;
+                }
+                //赋值
+                double PositionX = Convert.ToDouble(tbSPositionX.Text);
+                double PositionY = Convert.ToDouble(tbSPositionY.Text);
+                double PositionR = Convert.ToDouble(tbSPositionR.Text);
+                bool result = m_SemHardwareMgr.MoveSEMToPoint(PositionX, PositionY, PositionR);
+                if (result)
+                {
+                    ShowMessage(3);
+                    log.Info("Set successfully, current X and Y coordinates should be:(" + PositionX.ToString() + "," + PositionY.ToString() + PositionR.ToString() + ")");
+                }
+                else
+                {
+                    ShowMessage(4);
+                    log.Error("Failed to set X and Y coordinates!");
+                }
+            }
+            catch (Exception ex)
+            {
+                //记录日志信息
+                log.Error(ex.Message.ToString());
+            }
+        }
+
+        private void btn_Recommendedconfiguration_Click(object sender, EventArgs e)
+        {
+            if (recommendedConfiguration == null || recommendedConfiguration.IsDisposed)
+            {
+                recommendedConfiguration = new RecommendedConfiguration(Language.ReadDefaultLanguage());
+
+                recommendedConfiguration.Show();
+            }
+            else
+            {
+                recommendedConfiguration.Activate();
+            }
+        }
+
+        private void btn_continuousshot_Click(object sender, EventArgs e)
+        {
+            btn_continuousshot.Enabled = false;
+            btn_confirm.Enabled = false;
+            this.Refresh();
+
+            Graphics g = panel2.CreateGraphics();
+            //g.SmoothingMode = SmoothingMode.HighSpeed;
+            //g.CompositingQuality = CompositingQuality.HighSpeed;
+            g.PixelOffsetMode = PixelOffsetMode.HighQuality;//高质量低速度呈现
+
+            g.SmoothingMode = SmoothingMode.HighQuality;// 指定高质量、低速度呈现。
+            g.InterpolationMode = InterpolationMode.NearestNeighbor;
+
+            ISemController m_Sem = SemController.GetSEMController();
+            bool flag = m_Sem.Connect();
+            //电镜设置对象
+            var cfun = ScanController.GetScanController();
+
+            bool IsConnec = cfun.Init();
+
+            double Magnification = 0;
+            m_Sem.GetMagnification(ref Magnification);
+
+            //double a_dScanFieldSizeX = 0;
+            //double a_dScanFieldSizeY = 0;
+            //m_Sem.GetScanFieldSize(ref a_dScanFieldSizeX,ref a_dScanFieldSizeY);
+
+            double scanFieldSize100 = 0;
+            double.TryParse(tB_scanFieldSize100.Text, out scanFieldSize100);
+            double scanFieldSize = scanFieldSize100 * 100 / Magnification;
+
+            double PositionX = 0;
+            double PositionY = 0;
+            double PositionR = 0;
+            m_Sem.GetSemPositionXY(ref PositionX, ref PositionY, ref PositionR);
+
+            double PositionXO = PositionX;
+            double PositionYO = PositionY;
+            //double PositionR0 = PositionR;
+
+            int width = 1024;
+            int height = 768;
+            //设置图像分辨率
+            if (cb_imageresolution.Text.Trim() == "")
+            {
+                MessageBox.Show("imageresolution cannot be null!");
+                return;
+            }
+            else
+            {
+                width = Convert.ToInt32(cb_imageresolution.Text.Split('*')[0]);
+                height = Convert.ToInt32(cb_imageresolution.Text.Split('*')[1]);
+            }
+
+            this.Refresh();
+
+            double scanFieldSizeH = scanFieldSize * height / width;
+
+            m_Sem.SetScanExternal(true);
+
+            try
+            {
+                for (int i = 0; i < 4; i++)
+                {
+                    if (i == 0)
+                    {
+
+                    }
+                    else if (i == 1)
+                    {
+                        switch (cb_Xdirection.SelectedItem.ToString())
+                        {
+                            case "RIGHT_TOWARD": PositionX += scanFieldSize; break;
+                            default: PositionX -= scanFieldSize; break;
+                        }
+                        m_Sem.MoveSEMToPoint(PositionX, PositionY);
+                    }
+                    else if (i == 2)
+                    {
+                        switch (cb_Ydirection.SelectedItem.ToString())
+                        {
+                            case "UP_TOWARD": PositionY -= scanFieldSizeH; break;
+                            default: PositionY += scanFieldSizeH; break;
+                        }
+                        m_Sem.MoveSEMToPoint(PositionX, PositionY);
+                    }
+                    else
+                    {
+                        switch (cb_Xdirection.SelectedItem.ToString())
+                        {
+                            case "RIGHT_TOWARD": PositionX -= scanFieldSize; break;
+                            default: PositionX += scanFieldSize; break;
+                        }
+                        m_Sem.MoveSEMToPoint(PositionX, PositionY);
+                    }
+                    //Thread.Sleep(50);
+                    byte[] ImageByte = new byte[width * height];
+                    bool resultValue = GetScanImage(width, height, "2", ref ImageByte);
+                    Size size = new Size(panel2.Width / 2, panel2.Height / 2);
+
+                    if (resultValue)
+                    {
+                        if (ImageByte != null)
+                        {
+                            var bitmap = CImageHandler.ToGrayBitmap(ImageByte, width, height);
+                            switch (i)
+                            {
+                                case 0:
+                                    Point point0 = new Point(0, 0);
+                                    Rectangle rect0 = new Rectangle(point0, size);
+                                    g.DrawImage(bitmap, rect0);
+                                    break;
+                                case 1:
+                                    Point point1 = new Point(panel2.Width / 2, 0);
+                                    Rectangle rect1 = new Rectangle(point1, size);
+                                    g.DrawImage(bitmap, rect1);
+                                    break;
+                                case 2:
+                                    Point point2 = new Point(panel2.Width / 2, panel2.Height / 2);
+                                    Rectangle rect2 = new Rectangle(point2, size);
+                                    g.DrawImage(bitmap, rect2);
+                                    break;
+                                case 3:
+                                    Point point3 = new Point(0, panel2.Height / 2);
+                                    Rectangle rect3 = new Rectangle(point3, size);
+                                    g.DrawImage(bitmap, rect3);
+                                    break;
+                            }
+                            //this.Refresh();
+                        }
+                    }
+                }
+                m_Sem.MoveSEMToPoint(PositionXO, PositionYO);
+            }
+            catch (Exception ex)
+            {
+                log.Error("continuousshot--错误信息:" + ex.ToString());
+            }
+            finally
+            {
+                m_Sem.SetScanExternal(false);
+
+                btn_continuousshot.Enabled = true;
+                btn_confirm.Enabled = true;
+                btn_continuousshot.Refresh();
+
+                g.Dispose();
+            }
+        }
+
+        private bool GetScanImage(int iWidth, int iHeigh, string DwellTime, ref byte[] bImageData)
+        {
+
+            //电镜设置对象
+            var scan = ScanController.GetScanController();
+            int GetImgCount = 0;
+            try
+            {
+                //连接电镜
+                bool IsConnec = scan.Init();
+                if (!IsConnec)
+                {
+                    return false;
+                }
+
+
+
+                #region 设置图像分辨率
+                //设置宽度
+                if (!scan.SetImageSize(iWidth, iHeigh))
+                {
+
+                    return false;
+                }
+                #endregion
+
+                #region 采集时间
+                //采集时间
+                DwellTimeLevel nDwellTime = DwellTimeLevel.Low;
+                switch (DwellTime)
+                {
+                    case "Low":
+                        nDwellTime = DwellTimeLevel.Low;
+                        break;
+                    case "Medium":
+                        nDwellTime = DwellTimeLevel.Medium;
+                        break;
+                    case "High":
+                        nDwellTime = DwellTimeLevel.High;
+                        break;
+
+                }
+
+                //设置采集时间
+                if (!scan.SetDwellTime(nDwellTime))
+                {
+
+                    return false;
+                }
+                #endregion
+
+
+                int resultCount = iWidth * iHeigh;
+                var img = scan.AcquireBSEImage();
+                bImageData = img.GetImageDataPtr();
+
+
+            }
+            catch (Exception ex)
+            {
+                NLog.LogManager.GetCurrentClassLogger().Error(ex.ToString());
+                return false;
+            }
+
+            return true;
+
+        }
+        private void btn_confirm_Click(object sender, EventArgs e)
+        {
+            double dscanFieldSize100 = 0;
+            if (cb_Xdirection.Text.Trim() != null && cb_imageresolution.Text.Trim() != null && cb_Ydirection.Text.Trim() != null && double.TryParse(tB_scanFieldSize100.Text, out dscanFieldSize100))
+            {
+                string xmlpath = Application.StartupPath + @"\Config\SysData\OTSProgMgrParam.pmf";
+                string xAxisDir = "";
+                string yAxisDir = "";
+                switch (cb_Xdirection.SelectedItem.ToString())
+                {
+                    case "LEFT_TOWARD":
+                        xAxisDir = "0:LEFT_TOWARD";
+                        break;
+                    default:
+                        xAxisDir = "1:RIGHT_TOWARD";
+                        break;
+                }
+                switch (cb_Ydirection.Text)
+                {
+                    case "UP_TOWARD":
+                        yAxisDir = "0:" + cb_Ydirection.Text;
+                        break;
+                    default:
+                        yAxisDir = "1:DOWN_TOWARD";
+                        break;
+                }
+                SaveConfigXml(xmlpath, xAxisDir, yAxisDir, tB_scanFieldSize100.Text);
+            }
+            else
+            {
+                MessageBox.Show("Please check params!");
+            }
+        }
+        bool ReadConfigXml(string xmlpath, ref string xAxisDir, ref string yAxisDir, ref string scanFieldSize)
+        {
+            try
+            {
+                XmlDocument xmlDocument = new XmlDocument();
+                xmlDocument.Load(xmlpath);
+                XmlNodeList nodeList = xmlDocument.SelectSingleNode("XMLData").ChildNodes;
+
+                foreach (XmlNode xn in nodeList)
+                {
+                    XmlElement xe = (XmlElement)xn;
+                    if (xe.GetAttribute("RegName") == "StageData")
+                    {
+                        scanFieldSize = xe.GetAttribute("scanFieldSize");
+                        xAxisDir = xe.GetAttribute("xAxisDir");
+                        yAxisDir = xe.GetAttribute("yAxisDir");
+                        break;
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.ToString());
+                return false;
+            }
+            return true;
+        }
+        bool SaveConfigXml(string xmlpath, string xAxisDir, string yAxisDir, string scanFieldSize)
+        {
+            try
+            {
+                XmlDocument xmlDocument = new XmlDocument();
+                xmlDocument.Load(xmlpath);
+                XmlNodeList nodeList = xmlDocument.SelectSingleNode("XMLData").ChildNodes;
+
+                foreach (XmlNode xn in nodeList)
+                {
+                    XmlElement xe = (XmlElement)xn;
+                    if (xe.GetAttribute("RegName") == "StageData")
+                    {
+                        xe.SetAttribute("scanFieldSize", scanFieldSize);
+                        xe.SetAttribute("xAxisDir", xAxisDir);
+                        xe.SetAttribute("yAxisDir", yAxisDir);
+                        break;
+                    }
+                }
+
+                xmlDocument.Save(xmlpath);
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.ToString());
+                return false;
+            }
+            return true;
+        }
+        public bool ConnectionSem(connectionEnumType connectionType)
+        {
+            //连接电镜标识
+            bool DisConnResult = false;
+            //判断连接状态
+            if (!ConnectionState)
+            {
+                //连接电镜设置
+                DisConnResult = m_EDSHardwareMgr.Connect();
+            }
+            if (DisConnResult)
+            {
+                ConnectionState = true;
+            }
+            else
+            {
+                ConnectionState = false;
+            }
+            return DisConnResult;
+        }
+        #region 用户信息提示
+        /// <summary>
+        /// 提示
+        /// </summary>
+        /// <param name="Message"></param>
+        private void ShowMessage(int MessageType)
+        {
+            string message1 = table["message1"].ToString();
+            string message2 = table["message2"].ToString();
+            string message3 = table["message3"].ToString();
+            string message4 = table["message4"].ToString();
+            string message5 = table["message5"].ToString();
+            string message6 = table["message6"].ToString();
+            string message7 = table["message7"].ToString();
+            string message8 = table["message8"].ToString();
+            string message9 = table["message9"].ToString();
+            string message10 = table["message10"].ToString();
+            string MessageInfo = string.Empty;
+            switch (MessageType)
+            {
+                case 0:
+                    MessageInfo = message1;
+                    break;
+                case 1:
+                    MessageInfo = message2;
+                    break;
+                case 2:
+                    MessageInfo = message3;
+                    break;
+                case 3:
+                    MessageInfo = message4;
+                    break;
+                case 4:
+                    MessageInfo = message5;
+                    break;
+                case 5:
+                    MessageInfo = message6;
+                    break;
+                case 6:
+                    MessageInfo = message7;
+                    break;
+                case 7:
+                    MessageInfo = message8;
+                    break;
+                case 8:
+                    MessageInfo = message9;
+                    break;
+                case 9:
+                    MessageInfo = message10;
+                    break;
+            }
+            MessageBox.Show(MessageInfo, "Tip");
+        }
+        #endregion
+        #region 判断控制内容是否为空 与 判断输入的格式是否正确
+        /// <summary>
+        /// 判断控制内容是否为空
+        /// </summary>
+        /// <param name="tbContent"></param>
+        /// <returns></returns>
+        public bool IsNull(TextBox tbContent)
+        {
+            if (tbContent.Text.Trim().Equals(""))
+            {
+                //为空提示
+                ShowMessage(0);
+                //获取焦点
+                tbContent.Focus();
+                return false;
+            }
+            return true;
+        }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="objValue"></param>
+        /// <param name="objType"></param>
+        /// <returns></returns>
+        public bool IsType(object ObjValue, int ObjType)
+        {
+            try
+            {
+                switch (ObjType)
+                {
+                    case 1:
+                        int intValue = Convert.ToInt32(ObjValue);
+                        break;
+                    case 2:
+                        double douValue = Convert.ToDouble(ObjValue);
+                        break;
+                    case 3:
+                        float floValue = Convert.ToSingle(ObjValue);
+                        break;
+                }
+                return true;
+            }
+            catch (Exception)
+            {
+                //为空提示
+                ShowMessage(7);
+                return false;
+            }
+        }
+
+
+
+
+
+
+        #endregion
+
+        void InitEvent()
+        {
+            string edsType = FileHelper.GetXMLInformations("EDSName");
+            string SemType = FileHelper.GetXMLInformations("SemControllerName");
+
+            if (SemType == "FEI")
+            {
+                if (edsType == "FEI")
+                {
+                    cb_imageresolution.SelectedIndex = 2;
+
+                }
+                else if (edsType == "Oxford")
+                {
+                    cb_imageresolution.SelectedIndex = 0;
+
+                }
+                else if (edsType == "Bruker")
+                {
+                    cb_imageresolution.SelectedIndex = 1;
+
+                }
+                else if (edsType == "OffLine")
+                {
+                    cb_imageresolution.SelectedIndex = 1;
+                }
+                cb_Xdirection.SelectedIndex = 1;
+                cb_Ydirection.SelectedIndex = 0;
+            }
+        }
+
+        private void StageTest_Load(object sender, EventArgs e)
+        {
+            Control.CheckForIllegalCrossThreadCalls = false;
+
+            //m_EDSHardwareMgr = EDSController.GetEDSController(width, height, 5000, true, "");
+
+            cb_Xdirection.Items.Add("LEFT_TOWARD");
+            cb_Xdirection.Items.Add("RIGHT_TOWARD");
+            cb_Ydirection.Items.Add("UP_TOWARD");
+            cb_Ydirection.Items.Add("DOWN_TOWARD");
+            tB_scanFieldSize100.Text = "1270";
+            cb_imageresolution.Items.Add("1024*768");
+            cb_imageresolution.Items.Add("1024*704");
+            cb_imageresolution.Items.Add("1536*1024");
+            string xmlpath = Application.StartupPath + @"\Config\SysData\OTSProgMgrParam.pmf";
+            string xAxisDir = "";
+            string yAxisDir = "";
+            string scanFieldSize = "";
+            ReadConfigXml(xmlpath, ref xAxisDir, ref yAxisDir, ref scanFieldSize);
+            if (xAxisDir.Split(':')[1] == "LEFT_TOWARD")
+            {
+                cb_Xdirection.SelectedIndex = 0;
+            }
+            else
+            {
+                cb_Xdirection.SelectedIndex = 1;
+            }
+            if (yAxisDir.Split(':')[1] == "UP_TOWARD")
+            {
+                cb_Ydirection.SelectedIndex = 0;
+            }
+            else
+            {
+                cb_Ydirection.SelectedIndex = 1;
+            }
+            tB_scanFieldSize100.Text = scanFieldSize;
+            cb_imageresolution.SelectedIndex = 0;
+            InitEvent();
+        }
+    }
+}

+ 120 - 0
OTSSysMgrApp/StageTest.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>