Browse Source

添加谱峰图标准库编辑器

cxs 10 months ago
parent
commit
5b042b79a5
33 changed files with 2444 additions and 7327 deletions
  1. 0 1
      OTSIncAMeasureApp/ServiceCenter/CPP(Bruker)API/EDSController.cs
  2. 0 36
      OTSPartA_STDEditor/OTSPartA_STDEditor.csproj
  3. 0 157
      OTSPartA_STDEditor/UI/Form_GroupId.Designer.cs
  4. 0 552
      OTSPartA_STDEditor/UI/Form_GroupId.cs
  5. 0 123
      OTSPartA_STDEditor/UI/Form_GroupId.resx
  6. 0 696
      OTSPartA_STDEditor/UI/Form_MaxEDSRules.Designer.cs
  7. 0 1406
      OTSPartA_STDEditor/UI/Form_MaxEDSRules.cs
  8. 0 353
      OTSPartA_STDEditor/UI/Form_UserConstants.Designer.cs
  9. 0 544
      OTSPartA_STDEditor/UI/Form_UserConstants.cs
  10. 0 655
      OTSPartA_STDEditor/UI/Form_ZeroElementRules.Designer.cs
  11. 0 1424
      OTSPartA_STDEditor/UI/Form_ZeroElementRules.cs
  12. 0 123
      OTSPartA_STDEditor/UI/Form_ZeroElementRules.resx
  13. 259 0
      SpectrumSTDEditor/BaseClass/FileHelper.cs
  14. 76 72
      SpectrumSTDEditor/BaseClass/STDdata.cs
  15. 34 0
      SpectrumSTDEditor/BaseClass/shareFunction.cs
  16. 2 2
      SpectrumSTDEditor/Properties/AssemblyInfo.cs
  17. 57 10
      SpectrumSTDEditor/SpectrumSTDEditor.csproj
  18. 25 70
      SpectrumSTDEditor/UI/Attributes.cs
  19. 13 12
      SpectrumSTDEditor/UI/Form_GroupId.cs
  20. 77 135
      SpectrumSTDEditor/UI/Form_Main.Designer.cs
  21. 162 614
      SpectrumSTDEditor/UI/Form_Main.cs
  22. 30 18
      SpectrumSTDEditor/UI/Form_Main.resx
  23. 32 92
      SpectrumSTDEditor/UI/ReferenceLibrary.cs
  24. 68 61
      SpectrumSTDEditor/UI/STDEditor.Designer.cs
  25. 15 73
      SpectrumSTDEditor/UI/STDEditor.cs
  26. 28 32
      SpectrumSTDEditor/UI/STDRuleslist.cs
  27. 7 63
      SpectrumSTDEditor/UI/SubMidWindow.cs
  28. 48 0
      SpectrumSTDEditor/UI/UXrayControl.Designer.cs
  29. 486 0
      SpectrumSTDEditor/UI/UXrayControl.cs
  30. 0 0
      SpectrumSTDEditor/UI/UXrayControl.resx
  31. 158 0
      SpectrumSTDEditor/UI/XrayContrastForm.Designer.cs
  32. 867 0
      SpectrumSTDEditor/UI/XrayContrastForm.cs
  33. 0 3
      SpectrumSTDEditor/UI/XrayContrastForm.resx

+ 0 - 1
OTSIncAMeasureApp/ServiceCenter/CPP(Bruker)API/EDSController.cs

@@ -43,7 +43,6 @@ namespace OTSModelSharp.ServiceCenter
                    var delayQuant = false;//Now it has proved that this method won't increase the speed of xray analysis.So deactivate it here.
                     ctrl.delayQuant = delayQuant;
                     edsctrl = ctrl;
-
                 }
                 else if (deviceType == "OffLine")
                 {

+ 0 - 36
OTSPartA_STDEditor/OTSPartA_STDEditor.csproj

@@ -229,12 +229,6 @@
     <Compile Include="UI\NonLogicalUI\FormForWaiting.Designer.cs">
       <DependentUpon>FormForWaiting.cs</DependentUpon>
     </Compile>
-    <Compile Include="UI\Form_GroupId.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="UI\Form_GroupId.Designer.cs">
-      <DependentUpon>Form_GroupId.cs</DependentUpon>
-    </Compile>
     <Compile Include="UI\NonLogicalUI\Form_PeriodicTable.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -259,24 +253,6 @@
     <Compile Include="UI\ReferenceLibrary.Designer.cs">
       <DependentUpon>ReferenceLibrary.cs</DependentUpon>
     </Compile>
-    <Compile Include="UI\Form_MaxEDSRules.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="UI\Form_MaxEDSRules.Designer.cs">
-      <DependentUpon>Form_MaxEDSRules.cs</DependentUpon>
-    </Compile>
-    <Compile Include="UI\Form_UserConstants.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="UI\Form_UserConstants.Designer.cs">
-      <DependentUpon>Form_UserConstants.cs</DependentUpon>
-    </Compile>
-    <Compile Include="UI\Form_ZeroElementRules.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="UI\Form_ZeroElementRules.Designer.cs">
-      <DependentUpon>Form_ZeroElementRules.cs</DependentUpon>
-    </Compile>
     <Compile Include="BaseClass\STDdata.cs" />
     <Compile Include="UI\Form_Main.cs">
       <SubType>Form</SubType>
@@ -311,9 +287,6 @@
     <EmbeddedResource Include="UI\NonLogicalUI\FormForWaiting.resx">
       <DependentUpon>FormForWaiting.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="UI\Form_GroupId.resx">
-      <DependentUpon>Form_GroupId.cs</DependentUpon>
-    </EmbeddedResource>
     <EmbeddedResource Include="UI\NonLogicalUI\Form_PeriodicTable.resx">
       <DependentUpon>Form_PeriodicTable.cs</DependentUpon>
     </EmbeddedResource>
@@ -326,15 +299,6 @@
     <EmbeddedResource Include="UI\Form_Main.resx">
       <DependentUpon>Form_Main.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="UI\Form_MaxEDSRules.resx">
-      <DependentUpon>Form_MaxEDSRules.cs</DependentUpon>
-    </EmbeddedResource>
-    <EmbeddedResource Include="UI\Form_UserConstants.resx">
-      <DependentUpon>Form_UserConstants.cs</DependentUpon>
-    </EmbeddedResource>
-    <EmbeddedResource Include="UI\Form_ZeroElementRules.resx">
-      <DependentUpon>Form_ZeroElementRules.cs</DependentUpon>
-    </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <SubType>Designer</SubType>

+ 0 - 157
OTSPartA_STDEditor/UI/Form_GroupId.Designer.cs

@@ -1,157 +0,0 @@
-namespace OTSPartA_STDEditor
-{
-    partial class Form_GroupId
-    {
-        /// <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.components = new System.ComponentModel.Container();
-            this.button_OK = new System.Windows.Forms.Button();
-            this.button_Cancel = new System.Windows.Forms.Button();
-            this.Grid_FroupId = new SourceGrid.Grid();
-            this.contextMenuStrip_GroupId = new System.Windows.Forms.ContextMenuStrip(this.components);
-            this.ToolStripMenuItem_add = new System.Windows.Forms.ToolStripMenuItem();
-            this.删除组ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.button_up = new System.Windows.Forms.Button();
-            this.button_down = new System.Windows.Forms.Button();
-            this.contextMenuStrip_GroupId.SuspendLayout();
-            this.SuspendLayout();
-            // 
-            // button_OK
-            // 
-            this.button_OK.Location = new System.Drawing.Point(202, 731);
-            this.button_OK.Name = "button_OK";
-            this.button_OK.Size = new System.Drawing.Size(83, 31);
-            this.button_OK.TabIndex = 1;
-            this.button_OK.Text = "确定";
-            this.button_OK.UseVisualStyleBackColor = true;
-            this.button_OK.Click += new System.EventHandler(this.button_OK_Click);
-            // 
-            // button_Cancel
-            // 
-            this.button_Cancel.Location = new System.Drawing.Point(305, 731);
-            this.button_Cancel.Name = "button_Cancel";
-            this.button_Cancel.Size = new System.Drawing.Size(83, 31);
-            this.button_Cancel.TabIndex = 2;
-            this.button_Cancel.Text = "取消";
-            this.button_Cancel.UseVisualStyleBackColor = true;
-            this.button_Cancel.Click += new System.EventHandler(this.button_Cancel_Click);
-            // 
-            // Grid_FroupId
-            // 
-            this.Grid_FroupId.BackColor = System.Drawing.SystemColors.Control;
-            this.Grid_FroupId.ContextMenuStrip = this.contextMenuStrip_GroupId;
-            this.Grid_FroupId.EnableSort = true;
-            this.Grid_FroupId.Location = new System.Drawing.Point(34, 12);
-            this.Grid_FroupId.Name = "Grid_FroupId";
-            this.Grid_FroupId.OptimizeMode = SourceGrid.CellOptimizeMode.ForRows;
-            this.Grid_FroupId.SelectionMode = SourceGrid.GridSelectionMode.Cell;
-            this.Grid_FroupId.Size = new System.Drawing.Size(360, 700);
-            this.Grid_FroupId.TabIndex = 8;
-            this.Grid_FroupId.TabStop = true;
-            this.Grid_FroupId.ToolTipText = "";
-            this.Grid_FroupId.Click += new System.EventHandler(this.Grid_FroupId_Click);
-            // 
-            // contextMenuStrip_GroupId
-            // 
-            this.contextMenuStrip_GroupId.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.ToolStripMenuItem_add,
-            this.删除组ToolStripMenuItem});
-            this.contextMenuStrip_GroupId.Name = "contextMenuStrip_GroupId";
-            this.contextMenuStrip_GroupId.Size = new System.Drawing.Size(181, 70);
-            // 
-            // ToolStripMenuItem_add
-            // 
-            this.ToolStripMenuItem_add.Name = "ToolStripMenuItem_add";
-            this.ToolStripMenuItem_add.Size = new System.Drawing.Size(180, 22);
-            this.ToolStripMenuItem_add.Text = "添加组";
-            this.ToolStripMenuItem_add.Click += new System.EventHandler(this.添加组ToolStripMenuItem_Click);
-            // 
-            // 删除组ToolStripMenuItem
-            // 
-            this.删除组ToolStripMenuItem.Name = "删除组ToolStripMenuItem";
-            this.删除组ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
-            this.删除组ToolStripMenuItem.Text = "删除组";
-            this.删除组ToolStripMenuItem.Click += new System.EventHandler(this.删除组ToolStripMenuItem_Click);
-            // 
-            // button_up
-            // 
-            this.button_up.Enabled = false;
-            this.button_up.Font = new System.Drawing.Font("华文彩云", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_up.Location = new System.Drawing.Point(6, 56);
-            this.button_up.Name = "button_up";
-            this.button_up.Size = new System.Drawing.Size(22, 112);
-            this.button_up.TabIndex = 9;
-            this.button_up.Text = "↑";
-            this.button_up.UseVisualStyleBackColor = true;
-            this.button_up.Visible = false;
-            this.button_up.Click += new System.EventHandler(this.button_up_Click);
-            // 
-            // button_down
-            // 
-            this.button_down.Enabled = false;
-            this.button_down.Font = new System.Drawing.Font("华文彩云", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_down.Location = new System.Drawing.Point(6, 174);
-            this.button_down.Name = "button_down";
-            this.button_down.Size = new System.Drawing.Size(22, 112);
-            this.button_down.TabIndex = 10;
-            this.button_down.Text = "↓";
-            this.button_down.UseVisualStyleBackColor = true;
-            this.button_down.Visible = false;
-            this.button_down.Click += new System.EventHandler(this.button_down_Click);
-            // 
-            // Form_GroupId
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(400, 765);
-            this.Controls.Add(this.button_down);
-            this.Controls.Add(this.button_up);
-            this.Controls.Add(this.Grid_FroupId);
-            this.Controls.Add(this.button_Cancel);
-            this.Controls.Add(this.button_OK);
-            this.MaximizeBox = false;
-            this.Name = "Form_GroupId";
-            this.ShowIcon = false;
-            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
-            this.Text = "Form_GroupId";
-            this.Load += new System.EventHandler(this.Form_GroupId_Load);
-            this.contextMenuStrip_GroupId.ResumeLayout(false);
-            this.ResumeLayout(false);
-
-        }
-
-        #endregion
-        private System.Windows.Forms.Button button_OK;
-        private System.Windows.Forms.Button button_Cancel;
-        public SourceGrid.Grid Grid_FroupId;
-        private System.Windows.Forms.Button button_up;
-        private System.Windows.Forms.Button button_down;
-        private System.Windows.Forms.ContextMenuStrip contextMenuStrip_GroupId;
-        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem_add;
-        private System.Windows.Forms.ToolStripMenuItem 删除组ToolStripMenuItem;
-    }
-}

+ 0 - 552
OTSPartA_STDEditor/UI/Form_GroupId.cs

@@ -1,552 +0,0 @@
-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.Windows.Forms;
-
-namespace OTSPartA_STDEditor
-{
-    public partial class Form_GroupId : Form
-    {
-        public Form_Main m_MainForm = null;
-        //国际化
-        Language lan;
-        System.Collections.Hashtable table_GroupId;
-
-        string MineralGroupDBAddress = Application.StartupPath + "\\Config\\SysData\\" + "OTSCleanlinesSTD.db";
-        Dictionary<int,STDGroups> MineralGroupDictionary = new Dictionary<int, STDGroups>();
-        //Dictionary<int, STDGroups> MineralGroupDictionaryInitial = new Dictionary<int, STDGroups>();
-        /// <summary>
-        ///数据库修改状态
-        /// </summary>
-        public enum DBInfoState
-        {
-            Add = 0,
-            Modify = 1,
-            Delete = 2
-        }
-        object Clone(Dictionary<int, STDGroups> Dictionary)
-        {
-            Dictionary<int, STDGroups> DictionaryInitial = new Dictionary<int, STDGroups>();
-            foreach (var key in Dictionary.Keys)
-            {
-                STDGroups DGroups = new STDGroups();
-                DGroups = DGroups.Clone(Dictionary[key]) as STDGroups;
-                DictionaryInitial.Add(key,DGroups);
-            }
-            return DictionaryInitial;
-        }
-        bool LoadDataFromDb(string DBaddress)
-        {
-            try
-            {
-                System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + DBaddress + "'");
-                m_dbConnection.Open();
-                System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from STDGroups order by iorder", m_dbConnection);
-                DataSet ds = new DataSet();
-                m_dataAdapter.Fill(ds);
-                DataTable dt = ds.Tables[0];
-
-                if (dt != null)
-                {
-                    STDGroups new_data = new STDGroups();
-                    new_data.name = "Default";
-                    new_data.color = "#C9C9C9";
-                    new_data.iorder = 999;
-                    MineralGroupDictionary.Add(0, new_data);
-                    
-                    if (dt.Rows.Count > 0)
-                    {
-                        foreach (DataRow item in dt.Rows)
-                        {
-                            if (item["name"].ToString() != "Default")
-                            {
-                                STDGroups new_STDdata = new STDGroups();
-                                new_STDdata.name = item["name"].ToString();
-                                new_STDdata.color = item["color"].ToString();
-                                new_STDdata.iorder = int.Parse(item["iorder"].ToString());
-                                MineralGroupDictionary.Add(int.Parse(item["id"].ToString()), new_STDdata);
-                            }
-                        }
-                    }
-                    
-                }
-
-                m_dbConnection.Close();
-                return true;
-            }
-            catch(Exception ee)
-            {
-                MessageBox.Show(ee.ToString());
-                return false;
-            }
-       }
-
-        private void clickEvent_Click(object sender, EventArgs e)
-        {
-            SourceGrid.CellContext context = (SourceGrid.CellContext)sender;
-            int i = context.Position.Row;
-            int j = context.Position.Column;
-
-            /// 保证鼠标点击的GRID行和列是有效的
-            if (i >= 0 && j == 1)
-            {
-                ColorDialog cd = new ColorDialog();
-                cd.FullOpen = true;//自定义颜色界面打开
-                DialogResult result = cd.ShowDialog();
-                if (result == DialogResult.OK)
-                {
-                    SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
-                    view.BackColor = cd.Color;
-                    Grid_FroupId[i, 1].View = view;
-                    MineralGroupDictionary[(int)Grid_FroupId[i, 0].Tag].color = Attributes.colorRGBtoHx16(Grid_FroupId[i, 1].View.BackColor.R, Grid_FroupId[i, 1].View.BackColor.G, Grid_FroupId[i, 1].View.BackColor.B);
-                }
-            }
-            Grid_FroupId.Refresh();
-        }
-
-        void clickEvent_ValueChanged(object sender, EventArgs e)
-        {
-            SourceGrid.CellContext context = (SourceGrid.CellContext)sender;
-            int i = context.Position.Row;
-            int j = context.Position.Column;
-            if (i >= 0 && j == 0)
-            {
-                MineralGroupDictionary[(int)Grid_FroupId[i, 0].Tag].name = Grid_FroupId[i, 0].Value.ToString();
-                MineralGroupDictionary[(int)Grid_FroupId[i, 0].Tag].InfoState = (int)DBInfoState.Modify;
-            }
-        }
-
-        //查询数据是否存在
-        protected bool WhetherExistsInDBById(System.Data.SQLite.SQLiteConnection m_dbConnection, int id)
-        {
-            bool selResult = false;
-            System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from STDGroups where id=" + id.ToString() + "", m_dbConnection);
-            DataSet ds = new DataSet();
-            m_dataAdapter.Fill(ds);
-            DataTable dt = ds.Tables[0];
-            if (dt != null)
-            {
-                if (dt.Rows.Count > 0)
-                {
-                    selResult = true;
-                }
-            }
-            return selResult;
-        }
-
-        bool AddIntoDB(System.Data.SQLite.SQLiteConnection m_dbConnection,int id,string name,string color,int iorder)
-        {
-            System.Data.SQLite.SQLiteCommand cmm = m_dbConnection.CreateCommand();
-            try
-            {
-               string insertstr = "Insert into STDGroups(id,name,color,iorder)";
-               string aa = "values(" + id + ",'" + name + "','" + color + "'," + iorder+ ")";
-               cmm.CommandText = insertstr + aa;
-               cmm.ExecuteNonQuery();
-                return true;
-            }
-            catch /*(Exception ex)*/
-            {
-                return false;
-            }
-        }
-
-        bool UpdataInDB(System.Data.SQLite.SQLiteConnection m_dbConnection, int id, string name, string color, int iorder)
-        {
-            System.Data.SQLite.SQLiteCommand cmm = m_dbConnection.CreateCommand();
-            try
-            {
-                string insertstr = "update STDGroups set name='" + name + "',color='"+ color + "',iorder=" + iorder+ " where id=" + id + ";";
-                cmm.CommandText = insertstr;
-                cmm.ExecuteNonQuery();
-                return true;
-            }
-            catch /*(Exception ex)*/
-            {
-                return false;
-            }
-        }
-
-        bool DeleteInDB(System.Data.SQLite.SQLiteConnection m_dbConnection, int id, string name, string color, int iorder)
-        {
-            System.Data.SQLite.SQLiteCommand cmm = m_dbConnection.CreateCommand();
-            try
-            {
-                string insertstr = "delete from STDGroups where id=" + id + ";";
-                cmm.CommandText = insertstr;
-                cmm.ExecuteNonQuery();
-                return true;
-            }
-            catch /*(Exception ex)*/
-            {
-                return false;
-            }
-        }
-
-        void SaveDataIntoDB(string DBAddress)
-        {
-            for (int i = 2; i < Grid_FroupId.RowsCount; i++)
-            {
-                MineralGroupDictionary[(int)Grid_FroupId[i, 0].Tag].iorder = i-1;
-            }
-            System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + DBAddress + "'");
-            m_dbConnection.Open();
-
-            foreach (KeyValuePair<int, STDGroups> kv in MineralGroupDictionary)
-            {
-                int infoState = kv.Value.InfoState;
-                if (infoState == (int)DBInfoState.Modify)
-                {
-                    bool result = WhetherExistsInDBById(m_dbConnection, kv.Key);
-                    if (!result)
-                    {
-                        if (!AddIntoDB(m_dbConnection, kv.Key, kv.Value.name, kv.Value.color, kv.Value.iorder))
-                        {
-                            MessageBox.Show("Failed to add into database!", "Tip");
-                        }
-                    }
-                    else
-                    {
-                        if (!UpdataInDB(m_dbConnection, kv.Key, kv.Value.name, kv.Value.color, kv.Value.iorder))
-                        {
-                            MessageBox.Show("Failed to update to database!", "Tip");
-                        }
-                    }
-                }
-                else if (infoState == (int)DBInfoState.Delete)
-                {
-                    if (!DeleteInDB(m_dbConnection, kv.Key, kv.Value.name, kv.Value.color, kv.Value.iorder))
-                    {
-                        MessageBox.Show("Failed to delete data in database!", "Tip");
-                    }
-                }
-            }
-            m_dbConnection.Close();
-        }
-
-        public Form_GroupId(string DBAddress, Form_Main mainForm)
-        {
-            InitializeComponent();
-            MineralGroupDBAddress = DBAddress;
-            m_MainForm = mainForm;
-        }
-
-        private void Form_GroupId_Load(object sender, EventArgs e)
-        {
-            lan = new Language(this);
-            table_GroupId = lan.GetNameTable("Form_GroupId");
-            button_up.Enabled = false;
-            button_down.Enabled = false;
-            bool result = LoadDataFromDb(MineralGroupDBAddress); 
-            if(result)
-            {
-                Grid_FroupId.Redim(MineralGroupDictionary.Count + 1, 2);
-                Grid_FroupId.Rows.SetHeight(0, 25);
-                Grid_FroupId.AutoStretchColumnsToFitWidth = true;
-                Grid_FroupId.Selection.EnableMultiSelection = false;
-                Grid_FroupId.FixedRows = 1;
-                Grid_FroupId.Columns[0].Width = 190;
-                Grid_FroupId.Columns[1].Width = 135;
-
-
-                if (table_GroupId["language"].ToString() == "ZH")
-                {
-                    Grid_FroupId[0, 0] = new SourceGrid.Cells.Cell("组名称", typeof(string));
-                    Grid_FroupId[0, 1] = new SourceGrid.Cells.Cell("组颜色", typeof(string));
-                }
-                else
-                {
-                    Grid_FroupId[0, 0] = new SourceGrid.Cells.Cell("Group Name", typeof(string));
-                    Grid_FroupId[0, 1] = new SourceGrid.Cells.Cell("Group Color", typeof(string));
-                }
-                SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
-                view.Font = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
-                view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
-                view.BackColor = Color.LightGray;
-                Grid_FroupId[0, 0].View = view;
-                Grid_FroupId[0, 1].View = view;
-                Grid_FroupId[0, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
-                Grid_FroupId[0, 1].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
-
-                Grid_FroupId[1, 0] = new SourceGrid.Cells.Cell("Default", typeof(string));
-                Grid_FroupId[1, 1] = new SourceGrid.Cells.Cell("", typeof(string));
-                Grid_FroupId.Rows[1].Height = 25;
-                Grid_FroupId[1, 0].Tag = 0;
-
-                SourceGrid.Cells.Views.Cell vw = new SourceGrid.Cells.Views.Cell();
-                vw.BackColor = Attributes.colorHx16toRGB("#C9C9C9");
-                Grid_FroupId[1, 1].View = vw;
-                Grid_FroupId[1, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
-                Grid_FroupId[1, 1].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
-
-                int i = 2;
-                foreach (KeyValuePair<int, STDGroups> kv in MineralGroupDictionary)
-                {
-                    if (kv.Key != 0)
-                    {
-                        Grid_FroupId[i, 0] = new SourceGrid.Cells.Cell(kv.Value.name, typeof(string));
-                        Grid_FroupId[i, 1] = new SourceGrid.Cells.Cell("", typeof(string));
-                        Grid_FroupId.Rows[i].Height = 25;
-                        Grid_FroupId[i, 0].Tag = kv.Key;
-
-                        SourceGrid.Cells.Views.Cell vew = new SourceGrid.Cells.Views.Cell();
-                        vew.BackColor = Attributes.colorHx16toRGB(kv.Value.color);
-                        Grid_FroupId[i, 1].View = vew;
-
-                        SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents();
-                        clickEvent.ValueChanged += new EventHandler(clickEvent_ValueChanged);
-                        Grid_FroupId[i, 0].AddController(clickEvent);
-
-                        SourceGrid.Cells.Controllers.CustomEvents clickEvent2 = new SourceGrid.Cells.Controllers.CustomEvents();
-                        clickEvent2.Click += new EventHandler(clickEvent_Click);
-                        Grid_FroupId[i, 1].AddController(clickEvent2);
-
-                        i++;
-                    }
-                }
-            }
-            else
-            {
-                MessageBox.Show("Failed to read database", "Tip");
-            }
-        }
-        public int AddMineralGroupDictionaryItem()
-        {
-            STDGroups new_MineralGroup = new STDGroups();//定义一个TreeNode节点对象
-            new_MineralGroup.name = "New Group";
-            new_MineralGroup.color = Attributes.colorRGBtoHx16(Color.Gray.R, Color.Gray.G, Color.Gray.B);
-            new_MineralGroup.InfoState = (int)DBInfoState.Modify;
-
-            int Id = 100;
-            foreach (KeyValuePair<int, STDGroups> kv in MineralGroupDictionary)
-            {
-                if (Id < kv.Key)
-                {
-                    Id = kv.Key;
-                }
-            }
-
-            MineralGroupDictionary.Add(Id + 1, new_MineralGroup);
-            return Id + 1;
-        }
-
-        public void AddNewRow(int Id, string GroupName, Color color)
-        {
-            Grid_FroupId.Rows.Insert(Grid_FroupId.Rows.Count);
-            Grid_FroupId[Grid_FroupId.Rows.Count - 1, 0] = new SourceGrid.Cells.Cell(GroupName, typeof(string));
-            Grid_FroupId[Grid_FroupId.Rows.Count - 1, 1] = new SourceGrid.Cells.Cell("", typeof(string));
-            Grid_FroupId[Grid_FroupId.Rows.Count - 1, 0].Tag = Id;
-            Grid_FroupId.Rows[Grid_FroupId.Rows.Count - 1].Height = 25;
-
-            SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
-            view.BackColor = color;
-            Grid_FroupId[Grid_FroupId.Rows.Count - 1, 1].View = view;
-
-            SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents();
-            clickEvent.ValueChanged += new EventHandler(clickEvent_ValueChanged);
-            Grid_FroupId[Grid_FroupId.Rows.Count - 1, 0].AddController(clickEvent);
-
-            SourceGrid.Cells.Controllers.CustomEvents clickEvent2 = new SourceGrid.Cells.Controllers.CustomEvents();
-            clickEvent2.Click += new EventHandler(clickEvent_Click);
-            Grid_FroupId[Grid_FroupId.Rows.Count - 1, 1].AddController(clickEvent2);
-
-            Grid_FroupId.Refresh();
-
-            Position pos = new Position(Grid_FroupId.Rows.Count - 1, 0);
-            Grid_FroupId.Selection.Focus(pos, true);
-        }
-
-        public void RemoveMineralGroupDictionaryItem(int Id)
-        {
-            //MineralGroupDictionary.Remove(Id);
-            MineralGroupDictionary[Id].InfoState = (int)DBInfoState.Delete;
-        }
-
-        private void button_Cancel_Click(object sender, EventArgs e)
-        {
-            this.DialogResult = DialogResult.Cancel;
-            this.Close();
-        }
-
-        private void button_OK_Click(object sender, EventArgs e)
-        {
-            for (int i = 1; i < Grid_FroupId.RowsCount; i++)
-            {
-                for (int j = i+1; j < Grid_FroupId.RowsCount; j++)
-                {
-                    if(Grid_FroupId[i,0].ToString()== Grid_FroupId[j,0].ToString())
-                    {
-                        Position pos = new Position(i, 0);
-                        Grid_FroupId.Selection.Focus(pos, true);
-                        string DuplicateNames = Grid_FroupId[i, 0].ToString();
-                        MessageBox.Show("The names of groups are reusable which named " + DuplicateNames + ",please modify!", "Tip");
-                        return;
-                    }
-                }
-            }
-            SaveDataIntoDB(MineralGroupDBAddress);
-            this.DialogResult = DialogResult.Yes;
-            this.Close();
-        }
-
-        private void 添加组ToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-           int Id = AddMineralGroupDictionaryItem();
-           AddNewRow(Id, "New Group", Color.Gray);
-        }
-
-        private void 删除组ToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            int x = Grid_FroupId.Selection.ActivePosition.Row;
-            int y = Grid_FroupId.Selection.ActivePosition.Column;
-            if (x > 0 && (y == 0|| y == 1))
-            {
-                bool bexist = false;
-                foreach (KeyValuePair<int, STDdata> kv in m_MainForm.STDDictionary)
-                {
-                    if(kv.Value.GroupId.ToString()== Grid_FroupId[x, 0].Tag.ToString())
-                    {
-                        bexist = true;
-                        break;
-                    }
-                }
-                if(bexist)
-                {
-                    MessageBox.Show("There is a grouping in the user standard library that you want to delete!");
-                    return;
-                }
-                RemoveMineralGroupDictionaryItem((int)Grid_FroupId[x, 0].Tag);
-                Grid_FroupId.Rows.Remove(x);
-                Grid_FroupId.Refresh();
-                if (Grid_FroupId.RowsCount > 1)
-                {
-                    Position pos = new Position(1, 0);
-                    Grid_FroupId.Selection.Focus(pos, true);
-                    Grid_FroupId[1, 0].Grid.Select();
-                }
-            }
-            else
-            {
-                MessageBox.Show("No gruop is selected!", "Tip");
-
-            }
-        }
-
-        private void button_up_Click(object sender, EventArgs e)
-        {
-            Grid_FroupId.Focus(true);
-            int selrow = Grid_FroupId.Selection.ActivePosition.Row;
-
-            int id = (int)Grid_FroupId[selrow, 0].Tag;
-            int id2 = (int)Grid_FroupId[selrow - 1, 0].Tag;
-
-            string GroupName = Grid_FroupId[selrow, 0].Value.ToString();
-            Color color = Grid_FroupId[selrow, 1].View.BackColor;
-
-
-            Grid_FroupId[selrow, 0].Value = Grid_FroupId[selrow - 1, 0].Value;
-            Grid_FroupId[selrow, 0].Tag = id2;
-            SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
-            view.BackColor = Grid_FroupId[selrow - 1, 1].View.BackColor;
-            Grid_FroupId[selrow, 1].View = view;
-
-            Grid_FroupId[selrow - 1, 0].Value = GroupName;
-            Grid_FroupId[selrow - 1, 0].Tag = id;
-
-            SourceGrid.Cells.Views.Cell view2 = new SourceGrid.Cells.Views.Cell();
-            view2.BackColor = color;
-            Grid_FroupId[selrow - 1, 1].View = view2;
-
-            MineralGroupDictionary[id].name = Grid_FroupId[selrow - 1, 0].Value.ToString();
-            MineralGroupDictionary[id2].name = Grid_FroupId[selrow, 0].Value.ToString();
-
-            Grid_FroupId.Refresh();
-
-            Position pos = new Position(selrow - 1, 0);
-            Grid_FroupId[selrow - 1, 0].Grid.Select();
-            Grid_FroupId.Selection.Focus(pos, true);
-
-            button_down.Enabled = true;
-            if (selrow - 1 == 1)
-            {
-                button_up.Enabled = false;
-            }
-        }
-
-        private void button_down_Click(object sender, EventArgs e)
-        {
-            Grid_FroupId.Focus(true);
-            int selrow = Grid_FroupId.Selection.ActivePosition.Row;
-
-            int id = (int)Grid_FroupId[selrow, 0].Tag;
-            int id2 = (int)Grid_FroupId[selrow + 1, 0].Tag;
-
-            string GroupName = Grid_FroupId[selrow, 0].Value.ToString();
-            Color color = Grid_FroupId[selrow, 1].View.BackColor;
-
-            Grid_FroupId[selrow, 0].Value = Grid_FroupId[selrow + 1, 0].Value;
-            Grid_FroupId[selrow, 0].Tag = (int)Grid_FroupId[selrow + 1, 0].Tag;
-            SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
-            view.BackColor = Grid_FroupId[selrow+1, 1].View.BackColor;
-            Grid_FroupId[selrow, 1].View = view;
-
-            Grid_FroupId[selrow + 1, 0].Value = GroupName;
-            Grid_FroupId[selrow + 1, 0].Tag = id;
-            SourceGrid.Cells.Views.Cell view2 = new SourceGrid.Cells.Views.Cell();
-            view2.BackColor = color;
-            Grid_FroupId[selrow + 1, 1].View = view2;
-
-            MineralGroupDictionary[id].name = Grid_FroupId[selrow + 1, 0].Value.ToString();
-            MineralGroupDictionary[id2].name = Grid_FroupId[selrow, 0].Value.ToString();
-            Grid_FroupId.Refresh();
-
-            Position pos = new Position(selrow + 1, 0);
-            Grid_FroupId[selrow + 1, 0].Grid.Select();
-            Grid_FroupId.Selection.Focus(pos, true);
-
-            button_up.Enabled = true;
-            if (selrow + 1 == Grid_FroupId.RowsCount - 1)
-            {
-                button_down.Enabled = false;
-            }
-        }
-
-        private void Grid_FroupId_Click(object sender, EventArgs e)
-        {
-            SourceGrid.Grid ls_gd = (SourceGrid.Grid)sender;
-            ls_gd.Focus();
-            int i = ls_gd.Selection.ActivePosition.Row;
-            int j = ls_gd.Selection.ActivePosition.Column;
-
-            /// 保证鼠标点击的GRID行和列是有效的
-            if (i >= 0 && j >= 0)
-            {
-                if (i == ls_gd.RowsCount - 1)
-                {
-                    button_down.Enabled = false;
-                }
-                else
-                {
-                    button_down.Enabled = true;
-                }
-                if (i == 1)
-                {
-                    button_up.Enabled = false;
-                    //MessageBox.Show("Group by default, not editable!");
-                    //return;
-                }
-                else
-                {
-                    button_up.Enabled = true;
-                }
-                
-            }
-        }
-    }
-}

+ 0 - 123
OTSPartA_STDEditor/UI/Form_GroupId.resx

@@ -1,123 +0,0 @@
-<?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>
-  <metadata name="contextMenuStrip_GroupId.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>17, 17</value>
-  </metadata>
-</root>

+ 0 - 696
OTSPartA_STDEditor/UI/Form_MaxEDSRules.Designer.cs

@@ -1,696 +0,0 @@
-namespace OTSPartA_STDEditor
-{
-    partial class Form_MaxEDSRules
-    {
-        /// <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.components = new System.ComponentModel.Container();
-            this.XmlTreeMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
-            this.新建标准库规则ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.删除ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.XmlTree_MaxEDSRules = new System.Windows.Forms.TreeView();
-            this.button_Cancel = new System.Windows.Forms.Button();
-            this.textbox_STDEditor = new System.Windows.Forms.TextBox();
-            this.button_Ok = new System.Windows.Forms.Button();
-            this.button_0 = new System.Windows.Forms.Button();
-            this.button_9 = new System.Windows.Forms.Button();
-            this.button_4 = new System.Windows.Forms.Button();
-            this.button_5 = new System.Windows.Forms.Button();
-            this.button_6 = new System.Windows.Forms.Button();
-            this.button_7 = new System.Windows.Forms.Button();
-            this.button_8 = new System.Windows.Forms.Button();
-            this.button_Divide = new System.Windows.Forms.Button();
-            this.button_Or = new System.Windows.Forms.Button();
-            this.button_And = new System.Windows.Forms.Button();
-            this.button_3 = new System.Windows.Forms.Button();
-            this.button_2 = new System.Windows.Forms.Button();
-            this.button_1 = new System.Windows.Forms.Button();
-            this.button_Equal = new System.Windows.Forms.Button();
-            this.button_RightParenthesis = new System.Windows.Forms.Button();
-            this.button_LeftParenthesis = new System.Windows.Forms.Button();
-            this.button_Less = new System.Windows.Forms.Button();
-            this.button_More = new System.Windows.Forms.Button();
-            this.button_Multiply = new System.Windows.Forms.Button();
-            this.groupBox_CalculatingSymbols = new System.Windows.Forms.GroupBox();
-            this.button_Subtract = new System.Windows.Forms.Button();
-            this.button_Plus = new System.Windows.Forms.Button();
-            this.groupBox_Data = new System.Windows.Forms.GroupBox();
-            this.groupBox_XmlTree_MaxEDSRules = new System.Windows.Forms.GroupBox();
-            this.label1 = new System.Windows.Forms.Label();
-            this.textBox_MaxEDSTime = new System.Windows.Forms.TextBox();
-            this.button_Recover = new System.Windows.Forms.Button();
-            this.groupBox_ChemicalElement = new System.Windows.Forms.GroupBox();
-            this.comboBox_PeriodicTable = new System.Windows.Forms.ComboBox();
-            this.groupBox_OtherCommonlyUsedSymbols = new System.Windows.Forms.GroupBox();
-            this.comboBox_Constants = new System.Windows.Forms.ComboBox();
-            this.label_DefinedConstant = new System.Windows.Forms.Label();
-            this.label_Other = new System.Windows.Forms.Label();
-            this.label_ElementFormTwo = new System.Windows.Forms.Label();
-            this.label_ElementFormOne = new System.Windows.Forms.Label();
-            this.comboBox_Elem1 = new System.Windows.Forms.ComboBox();
-            this.comboBox_Elem = new System.Windows.Forms.ComboBox();
-            this.comboBox_ImgProperty = new System.Windows.Forms.ComboBox();
-            this.PeriodicTableSwitch = new System.Windows.Forms.Button();
-            this.XmlTreeMenuStrip.SuspendLayout();
-            this.groupBox_CalculatingSymbols.SuspendLayout();
-            this.groupBox_Data.SuspendLayout();
-            this.groupBox_XmlTree_MaxEDSRules.SuspendLayout();
-            this.groupBox_ChemicalElement.SuspendLayout();
-            this.groupBox_OtherCommonlyUsedSymbols.SuspendLayout();
-            this.SuspendLayout();
-            // 
-            // XmlTreeMenuStrip
-            // 
-            this.XmlTreeMenuStrip.ImageScalingSize = new System.Drawing.Size(24, 24);
-            this.XmlTreeMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.新建标准库规则ToolStripMenuItem,
-            this.删除ToolStripMenuItem});
-            this.XmlTreeMenuStrip.Name = "XmlTreeMenuStrip";
-            this.XmlTreeMenuStrip.Size = new System.Drawing.Size(101, 48);
-            // 
-            // 新建标准库规则ToolStripMenuItem
-            // 
-            this.新建标准库规则ToolStripMenuItem.Name = "新建标准库规则ToolStripMenuItem";
-            this.新建标准库规则ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
-            this.新建标准库规则ToolStripMenuItem.Text = "新建";
-            this.新建标准库规则ToolStripMenuItem.Click += new System.EventHandler(this.AddTreeNode_Click);
-            // 
-            // 删除ToolStripMenuItem
-            // 
-            this.删除ToolStripMenuItem.Name = "删除ToolStripMenuItem";
-            this.删除ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
-            this.删除ToolStripMenuItem.Text = "删除";
-            this.删除ToolStripMenuItem.Click += new System.EventHandler(this.DeleteTreeNode_Click);
-            // 
-            // XmlTree_MaxEDSRules
-            // 
-            this.XmlTree_MaxEDSRules.ContextMenuStrip = this.XmlTreeMenuStrip;
-            this.XmlTree_MaxEDSRules.HideSelection = false;
-            this.XmlTree_MaxEDSRules.Location = new System.Drawing.Point(12, 12);
-            this.XmlTree_MaxEDSRules.Name = "XmlTree_MaxEDSRules";
-            this.XmlTree_MaxEDSRules.Size = new System.Drawing.Size(183, 523);
-            this.XmlTree_MaxEDSRules.TabIndex = 2;
-            this.XmlTree_MaxEDSRules.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.XmlTree_MaxEDSRules_BeforeSelect);
-            this.XmlTree_MaxEDSRules.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.XmlTree_MaxEDSRules_AfterSelect);
-            // 
-            // button_Cancel
-            // 
-            this.button_Cancel.Location = new System.Drawing.Point(552, 310);
-            this.button_Cancel.Name = "button_Cancel";
-            this.button_Cancel.Size = new System.Drawing.Size(103, 36);
-            this.button_Cancel.TabIndex = 24;
-            this.button_Cancel.Text = "离开";
-            this.button_Cancel.UseVisualStyleBackColor = true;
-            this.button_Cancel.Click += new System.EventHandler(this.button_Cancel_Click);
-            // 
-            // textbox_STDEditor
-            // 
-            this.textbox_STDEditor.Font = new System.Drawing.Font("宋体", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.textbox_STDEditor.Location = new System.Drawing.Point(222, 12);
-            this.textbox_STDEditor.Multiline = true;
-            this.textbox_STDEditor.Name = "textbox_STDEditor";
-            this.textbox_STDEditor.Size = new System.Drawing.Size(628, 166);
-            this.textbox_STDEditor.TabIndex = 30;
-            // 
-            // button_Ok
-            // 
-            this.button_Ok.Location = new System.Drawing.Point(443, 311);
-            this.button_Ok.Name = "button_Ok";
-            this.button_Ok.Size = new System.Drawing.Size(103, 36);
-            this.button_Ok.TabIndex = 23;
-            this.button_Ok.Text = "确认";
-            this.button_Ok.UseVisualStyleBackColor = true;
-            this.button_Ok.Click += new System.EventHandler(this.button_Ok_Click);
-            // 
-            // button_0
-            // 
-            this.button_0.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_0.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_0.Location = new System.Drawing.Point(204, 69);
-            this.button_0.Name = "button_0";
-            this.button_0.Size = new System.Drawing.Size(40, 40);
-            this.button_0.TabIndex = 26;
-            this.button_0.Text = "0";
-            this.button_0.UseVisualStyleBackColor = true;
-            this.button_0.Click += new System.EventHandler(this.button_0_Click);
-            // 
-            // button_9
-            // 
-            this.button_9.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_9.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_9.Location = new System.Drawing.Point(157, 70);
-            this.button_9.Name = "button_9";
-            this.button_9.Size = new System.Drawing.Size(40, 40);
-            this.button_9.TabIndex = 25;
-            this.button_9.Text = "9";
-            this.button_9.UseVisualStyleBackColor = true;
-            this.button_9.Click += new System.EventHandler(this.button_9_Click);
-            // 
-            // button_4
-            // 
-            this.button_4.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_4.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_4.Location = new System.Drawing.Point(157, 21);
-            this.button_4.Name = "button_4";
-            this.button_4.Size = new System.Drawing.Size(40, 40);
-            this.button_4.TabIndex = 24;
-            this.button_4.Text = "4";
-            this.button_4.UseVisualStyleBackColor = true;
-            this.button_4.Click += new System.EventHandler(this.button_4_Click);
-            // 
-            // button_5
-            // 
-            this.button_5.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_5.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_5.Location = new System.Drawing.Point(204, 21);
-            this.button_5.Name = "button_5";
-            this.button_5.Size = new System.Drawing.Size(40, 40);
-            this.button_5.TabIndex = 23;
-            this.button_5.Text = "5";
-            this.button_5.UseVisualStyleBackColor = true;
-            this.button_5.Click += new System.EventHandler(this.button_5_Click);
-            // 
-            // button_6
-            // 
-            this.button_6.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_6.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_6.Location = new System.Drawing.Point(11, 70);
-            this.button_6.Name = "button_6";
-            this.button_6.Size = new System.Drawing.Size(40, 40);
-            this.button_6.TabIndex = 22;
-            this.button_6.Text = "6";
-            this.button_6.UseVisualStyleBackColor = true;
-            this.button_6.Click += new System.EventHandler(this.button_6_Click);
-            // 
-            // button_7
-            // 
-            this.button_7.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_7.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_7.Location = new System.Drawing.Point(60, 70);
-            this.button_7.Name = "button_7";
-            this.button_7.Size = new System.Drawing.Size(40, 40);
-            this.button_7.TabIndex = 21;
-            this.button_7.Text = "7";
-            this.button_7.UseVisualStyleBackColor = true;
-            this.button_7.Click += new System.EventHandler(this.button_7_Click);
-            // 
-            // button_8
-            // 
-            this.button_8.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_8.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_8.Location = new System.Drawing.Point(109, 70);
-            this.button_8.Name = "button_8";
-            this.button_8.Size = new System.Drawing.Size(40, 40);
-            this.button_8.TabIndex = 20;
-            this.button_8.Text = "8";
-            this.button_8.UseVisualStyleBackColor = true;
-            this.button_8.Click += new System.EventHandler(this.button_8_Click);
-            // 
-            // button_Divide
-            // 
-            this.button_Divide.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_Divide.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_Divide.Location = new System.Drawing.Point(157, 120);
-            this.button_Divide.Name = "button_Divide";
-            this.button_Divide.Size = new System.Drawing.Size(40, 40);
-            this.button_Divide.TabIndex = 8;
-            this.button_Divide.Text = "/";
-            this.button_Divide.UseVisualStyleBackColor = true;
-            this.button_Divide.Click += new System.EventHandler(this.button_Divide_Click);
-            // 
-            // button_Or
-            // 
-            this.button_Or.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_Or.Font = new System.Drawing.Font("方正舒体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_Or.Location = new System.Drawing.Point(156, 217);
-            this.button_Or.Name = "button_Or";
-            this.button_Or.Size = new System.Drawing.Size(86, 40);
-            this.button_Or.TabIndex = 15;
-            this.button_Or.Text = "or";
-            this.button_Or.UseVisualStyleBackColor = true;
-            this.button_Or.Click += new System.EventHandler(this.button_Or_Click);
-            // 
-            // button_And
-            // 
-            this.button_And.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_And.Font = new System.Drawing.Font("方正舒体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_And.Location = new System.Drawing.Point(10, 218);
-            this.button_And.Name = "button_And";
-            this.button_And.Size = new System.Drawing.Size(139, 40);
-            this.button_And.TabIndex = 14;
-            this.button_And.Text = "and";
-            this.button_And.UseVisualStyleBackColor = true;
-            this.button_And.Click += new System.EventHandler(this.button_And_Click);
-            // 
-            // button_3
-            // 
-            this.button_3.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_3.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_3.Location = new System.Drawing.Point(109, 21);
-            this.button_3.Name = "button_3";
-            this.button_3.Size = new System.Drawing.Size(40, 40);
-            this.button_3.TabIndex = 19;
-            this.button_3.Text = "3";
-            this.button_3.UseVisualStyleBackColor = true;
-            this.button_3.Click += new System.EventHandler(this.button_3_Click);
-            // 
-            // button_2
-            // 
-            this.button_2.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_2.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_2.Location = new System.Drawing.Point(59, 21);
-            this.button_2.Name = "button_2";
-            this.button_2.Size = new System.Drawing.Size(40, 40);
-            this.button_2.TabIndex = 18;
-            this.button_2.Text = "2";
-            this.button_2.UseVisualStyleBackColor = true;
-            this.button_2.Click += new System.EventHandler(this.button_2_Click);
-            // 
-            // button_1
-            // 
-            this.button_1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_1.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_1.Location = new System.Drawing.Point(10, 21);
-            this.button_1.Name = "button_1";
-            this.button_1.Size = new System.Drawing.Size(40, 40);
-            this.button_1.TabIndex = 17;
-            this.button_1.Text = "1";
-            this.button_1.UseVisualStyleBackColor = true;
-            this.button_1.Click += new System.EventHandler(this.button_1_Click);
-            // 
-            // button_Equal
-            // 
-            this.button_Equal.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_Equal.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_Equal.Location = new System.Drawing.Point(204, 120);
-            this.button_Equal.Name = "button_Equal";
-            this.button_Equal.Size = new System.Drawing.Size(40, 40);
-            this.button_Equal.TabIndex = 16;
-            this.button_Equal.Text = "=";
-            this.button_Equal.UseVisualStyleBackColor = true;
-            this.button_Equal.Click += new System.EventHandler(this.button_Equal_Click);
-            // 
-            // button_RightParenthesis
-            // 
-            this.button_RightParenthesis.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_RightParenthesis.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_RightParenthesis.Location = new System.Drawing.Point(157, 169);
-            this.button_RightParenthesis.Name = "button_RightParenthesis";
-            this.button_RightParenthesis.Size = new System.Drawing.Size(40, 40);
-            this.button_RightParenthesis.TabIndex = 13;
-            this.button_RightParenthesis.Text = ")";
-            this.button_RightParenthesis.UseVisualStyleBackColor = true;
-            this.button_RightParenthesis.Click += new System.EventHandler(this.button_RightParenthesis_Click);
-            // 
-            // button_LeftParenthesis
-            // 
-            this.button_LeftParenthesis.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_LeftParenthesis.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_LeftParenthesis.Location = new System.Drawing.Point(109, 169);
-            this.button_LeftParenthesis.Name = "button_LeftParenthesis";
-            this.button_LeftParenthesis.Size = new System.Drawing.Size(40, 40);
-            this.button_LeftParenthesis.TabIndex = 12;
-            this.button_LeftParenthesis.Text = "(";
-            this.button_LeftParenthesis.UseVisualStyleBackColor = true;
-            this.button_LeftParenthesis.Click += new System.EventHandler(this.button_LeftParenthesis_Click);
-            // 
-            // button_Less
-            // 
-            this.button_Less.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_Less.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_Less.Location = new System.Drawing.Point(59, 169);
-            this.button_Less.Name = "button_Less";
-            this.button_Less.Size = new System.Drawing.Size(40, 40);
-            this.button_Less.TabIndex = 11;
-            this.button_Less.Text = "<";
-            this.button_Less.UseVisualStyleBackColor = true;
-            this.button_Less.Click += new System.EventHandler(this.button_Less_Click);
-            // 
-            // button_More
-            // 
-            this.button_More.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_More.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_More.Location = new System.Drawing.Point(10, 169);
-            this.button_More.Name = "button_More";
-            this.button_More.Size = new System.Drawing.Size(40, 40);
-            this.button_More.TabIndex = 10;
-            this.button_More.Text = ">";
-            this.button_More.UseVisualStyleBackColor = true;
-            this.button_More.Click += new System.EventHandler(this.button_More_Click);
-            // 
-            // button_Multiply
-            // 
-            this.button_Multiply.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_Multiply.Font = new System.Drawing.Font("方正舒体", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_Multiply.Location = new System.Drawing.Point(109, 120);
-            this.button_Multiply.Name = "button_Multiply";
-            this.button_Multiply.Size = new System.Drawing.Size(40, 40);
-            this.button_Multiply.TabIndex = 9;
-            this.button_Multiply.Text = "*";
-            this.button_Multiply.UseVisualStyleBackColor = true;
-            this.button_Multiply.Click += new System.EventHandler(this.button_Multiply_Click);
-            // 
-            // groupBox_CalculatingSymbols
-            // 
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_0);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_9);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_4);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_5);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_6);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_7);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_8);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_Divide);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_Or);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_And);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_3);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_2);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_1);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_Equal);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_RightParenthesis);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_LeftParenthesis);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_Less);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_More);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_Multiply);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_Subtract);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_Plus);
-            this.groupBox_CalculatingSymbols.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.groupBox_CalculatingSymbols.Location = new System.Drawing.Point(413, 16);
-            this.groupBox_CalculatingSymbols.Name = "groupBox_CalculatingSymbols";
-            this.groupBox_CalculatingSymbols.Size = new System.Drawing.Size(250, 269);
-            this.groupBox_CalculatingSymbols.TabIndex = 31;
-            this.groupBox_CalculatingSymbols.TabStop = false;
-            this.groupBox_CalculatingSymbols.Text = "运算符号";
-            // 
-            // button_Subtract
-            // 
-            this.button_Subtract.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_Subtract.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_Subtract.Location = new System.Drawing.Point(59, 120);
-            this.button_Subtract.Name = "button_Subtract";
-            this.button_Subtract.Size = new System.Drawing.Size(40, 40);
-            this.button_Subtract.TabIndex = 7;
-            this.button_Subtract.Text = "-";
-            this.button_Subtract.UseVisualStyleBackColor = true;
-            this.button_Subtract.Click += new System.EventHandler(this.button_Subtract_Click);
-            // 
-            // button_Plus
-            // 
-            this.button_Plus.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_Plus.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_Plus.Location = new System.Drawing.Point(10, 120);
-            this.button_Plus.Name = "button_Plus";
-            this.button_Plus.Size = new System.Drawing.Size(40, 40);
-            this.button_Plus.TabIndex = 6;
-            this.button_Plus.Text = "+";
-            this.button_Plus.UseVisualStyleBackColor = true;
-            this.button_Plus.Click += new System.EventHandler(this.button_Plus_Click);
-            // 
-            // groupBox_Data
-            // 
-            this.groupBox_Data.Controls.Add(this.groupBox_CalculatingSymbols);
-            this.groupBox_Data.Controls.Add(this.groupBox_XmlTree_MaxEDSRules);
-            this.groupBox_Data.Controls.Add(this.button_Recover);
-            this.groupBox_Data.Controls.Add(this.groupBox_ChemicalElement);
-            this.groupBox_Data.Controls.Add(this.groupBox_OtherCommonlyUsedSymbols);
-            this.groupBox_Data.Controls.Add(this.button_Ok);
-            this.groupBox_Data.Controls.Add(this.button_Cancel);
-            this.groupBox_Data.FlatStyle = System.Windows.Forms.FlatStyle.System;
-            this.groupBox_Data.Location = new System.Drawing.Point(222, 184);
-            this.groupBox_Data.Name = "groupBox_Data";
-            this.groupBox_Data.Size = new System.Drawing.Size(669, 351);
-            this.groupBox_Data.TabIndex = 29;
-            this.groupBox_Data.TabStop = false;
-            // 
-            // groupBox_XmlTree_MaxEDSRules
-            // 
-            this.groupBox_XmlTree_MaxEDSRules.Controls.Add(this.label1);
-            this.groupBox_XmlTree_MaxEDSRules.Controls.Add(this.textBox_MaxEDSTime);
-            this.groupBox_XmlTree_MaxEDSRules.Location = new System.Drawing.Point(9, 179);
-            this.groupBox_XmlTree_MaxEDSRules.Name = "groupBox_XmlTree_MaxEDSRules";
-            this.groupBox_XmlTree_MaxEDSRules.Size = new System.Drawing.Size(184, 106);
-            this.groupBox_XmlTree_MaxEDSRules.TabIndex = 30;
-            this.groupBox_XmlTree_MaxEDSRules.TabStop = false;
-            this.groupBox_XmlTree_MaxEDSRules.Text = "MaxEDSTime";
-            // 
-            // label1
-            // 
-            this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(158, 48);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(17, 12);
-            this.label1.TabIndex = 22;
-            this.label1.Text = "ms";
-            // 
-            // textBox_MaxEDSTime
-            // 
-            this.textBox_MaxEDSTime.Location = new System.Drawing.Point(55, 45);
-            this.textBox_MaxEDSTime.Name = "textBox_MaxEDSTime";
-            this.textBox_MaxEDSTime.Size = new System.Drawing.Size(99, 21);
-            this.textBox_MaxEDSTime.TabIndex = 21;
-            this.textBox_MaxEDSTime.Text = "200";
-            this.textBox_MaxEDSTime.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
-            // button_Recover
-            // 
-            this.button_Recover.Location = new System.Drawing.Point(6, 324);
-            this.button_Recover.Name = "button_Recover";
-            this.button_Recover.Size = new System.Drawing.Size(184, 23);
-            this.button_Recover.TabIndex = 25;
-            this.button_Recover.Text = "恢复至出厂默认值";
-            this.button_Recover.UseVisualStyleBackColor = true;
-            this.button_Recover.Visible = false;
-            this.button_Recover.Click += new System.EventHandler(this.button_Recover_Click);
-            // 
-            // groupBox_ChemicalElement
-            // 
-            this.groupBox_ChemicalElement.Controls.Add(this.comboBox_PeriodicTable);
-            this.groupBox_ChemicalElement.Location = new System.Drawing.Point(9, 20);
-            this.groupBox_ChemicalElement.Name = "groupBox_ChemicalElement";
-            this.groupBox_ChemicalElement.Size = new System.Drawing.Size(184, 148);
-            this.groupBox_ChemicalElement.TabIndex = 5;
-            this.groupBox_ChemicalElement.TabStop = false;
-            this.groupBox_ChemicalElement.Text = "化学元素";
-            // 
-            // comboBox_PeriodicTable
-            // 
-            this.comboBox_PeriodicTable.FormattingEnabled = true;
-            this.comboBox_PeriodicTable.Location = new System.Drawing.Point(21, 40);
-            this.comboBox_PeriodicTable.Name = "comboBox_PeriodicTable";
-            this.comboBox_PeriodicTable.Size = new System.Drawing.Size(149, 20);
-            this.comboBox_PeriodicTable.TabIndex = 1;
-            this.comboBox_PeriodicTable.SelectedIndexChanged += new System.EventHandler(this.comboBox_PeriodicTable_SelectedIndexChanged);
-            this.comboBox_PeriodicTable.KeyDown += new System.Windows.Forms.KeyEventHandler(this.comboBox_PeriodicTable_KeyDown);
-            // 
-            // groupBox_OtherCommonlyUsedSymbols
-            // 
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.comboBox_Constants);
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.label_DefinedConstant);
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.label_Other);
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.label_ElementFormTwo);
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.label_ElementFormOne);
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.comboBox_Elem1);
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.comboBox_Elem);
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.comboBox_ImgProperty);
-            this.groupBox_OtherCommonlyUsedSymbols.Location = new System.Drawing.Point(199, 20);
-            this.groupBox_OtherCommonlyUsedSymbols.Name = "groupBox_OtherCommonlyUsedSymbols";
-            this.groupBox_OtherCommonlyUsedSymbols.Size = new System.Drawing.Size(208, 265);
-            this.groupBox_OtherCommonlyUsedSymbols.TabIndex = 3;
-            this.groupBox_OtherCommonlyUsedSymbols.TabStop = false;
-            this.groupBox_OtherCommonlyUsedSymbols.Text = "其它常用符号";
-            // 
-            // comboBox_Constants
-            // 
-            this.comboBox_Constants.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.comboBox_Constants.FormattingEnabled = true;
-            this.comboBox_Constants.Location = new System.Drawing.Point(107, 175);
-            this.comboBox_Constants.Name = "comboBox_Constants";
-            this.comboBox_Constants.Size = new System.Drawing.Size(96, 20);
-            this.comboBox_Constants.TabIndex = 5;
-            this.comboBox_Constants.SelectedIndexChanged += new System.EventHandler(this.comboBox_Constants_SelectedIndexChanged);
-            // 
-            // label_DefinedConstant
-            // 
-            this.label_DefinedConstant.AutoSize = true;
-            this.label_DefinedConstant.Location = new System.Drawing.Point(6, 178);
-            this.label_DefinedConstant.Name = "label_DefinedConstant";
-            this.label_DefinedConstant.Size = new System.Drawing.Size(77, 12);
-            this.label_DefinedConstant.TabIndex = 19;
-            this.label_DefinedConstant.Text = "已定义常数:";
-            // 
-            // label_Other
-            // 
-            this.label_Other.AutoSize = true;
-            this.label_Other.Location = new System.Drawing.Point(6, 131);
-            this.label_Other.Name = "label_Other";
-            this.label_Other.Size = new System.Drawing.Size(41, 12);
-            this.label_Other.TabIndex = 10;
-            this.label_Other.Text = "其它:";
-            // 
-            // label_ElementFormTwo
-            // 
-            this.label_ElementFormTwo.AutoSize = true;
-            this.label_ElementFormTwo.Location = new System.Drawing.Point(6, 84);
-            this.label_ElementFormTwo.Name = "label_ElementFormTwo";
-            this.label_ElementFormTwo.Size = new System.Drawing.Size(77, 12);
-            this.label_ElementFormTwo.TabIndex = 9;
-            this.label_ElementFormTwo.Text = "元素形式二:";
-            // 
-            // label_ElementFormOne
-            // 
-            this.label_ElementFormOne.AutoSize = true;
-            this.label_ElementFormOne.Location = new System.Drawing.Point(6, 34);
-            this.label_ElementFormOne.Name = "label_ElementFormOne";
-            this.label_ElementFormOne.Size = new System.Drawing.Size(77, 12);
-            this.label_ElementFormOne.TabIndex = 8;
-            this.label_ElementFormOne.Text = "元素形式一:";
-            // 
-            // comboBox_Elem1
-            // 
-            this.comboBox_Elem1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.comboBox_Elem1.FormattingEnabled = true;
-            this.comboBox_Elem1.Location = new System.Drawing.Point(107, 31);
-            this.comboBox_Elem1.Name = "comboBox_Elem1";
-            this.comboBox_Elem1.Size = new System.Drawing.Size(96, 20);
-            this.comboBox_Elem1.TabIndex = 2;
-            this.comboBox_Elem1.SelectedIndexChanged += new System.EventHandler(this.comboBox_Elem1_SelectedIndexChanged);
-            // 
-            // comboBox_Elem
-            // 
-            this.comboBox_Elem.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.comboBox_Elem.FormattingEnabled = true;
-            this.comboBox_Elem.Location = new System.Drawing.Point(107, 81);
-            this.comboBox_Elem.Name = "comboBox_Elem";
-            this.comboBox_Elem.Size = new System.Drawing.Size(96, 20);
-            this.comboBox_Elem.TabIndex = 3;
-            this.comboBox_Elem.SelectedIndexChanged += new System.EventHandler(this.comboBox_Elem2_SelectedIndexChanged);
-            // 
-            // comboBox_ImgProperty
-            // 
-            this.comboBox_ImgProperty.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.comboBox_ImgProperty.FormattingEnabled = true;
-            this.comboBox_ImgProperty.Location = new System.Drawing.Point(107, 128);
-            this.comboBox_ImgProperty.Name = "comboBox_ImgProperty";
-            this.comboBox_ImgProperty.Size = new System.Drawing.Size(96, 20);
-            this.comboBox_ImgProperty.TabIndex = 4;
-            this.comboBox_ImgProperty.SelectedIndexChanged += new System.EventHandler(this.comboBox_ImgProperty_SelectedIndexChanged);
-            // 
-            // PeriodicTableSwitch
-            // 
-            this.PeriodicTableSwitch.BackColor = System.Drawing.SystemColors.Control;
-            this.PeriodicTableSwitch.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
-            this.PeriodicTableSwitch.Font = new System.Drawing.Font("楷体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PeriodicTableSwitch.Location = new System.Drawing.Point(856, 11);
-            this.PeriodicTableSwitch.Name = "PeriodicTableSwitch";
-            this.PeriodicTableSwitch.Size = new System.Drawing.Size(29, 167);
-            this.PeriodicTableSwitch.TabIndex = 33;
-            this.PeriodicTableSwitch.UseVisualStyleBackColor = false;
-            this.PeriodicTableSwitch.Click += new System.EventHandler(this.PeriodicTableSwitch_Click);
-            // 
-            // Form_MaxEDSRules
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.AutoSize = true;
-            this.ClientSize = new System.Drawing.Size(894, 542);
-            this.Controls.Add(this.XmlTree_MaxEDSRules);
-            this.Controls.Add(this.textbox_STDEditor);
-            this.Controls.Add(this.groupBox_Data);
-            this.Controls.Add(this.PeriodicTableSwitch);
-            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
-            this.MaximizeBox = false;
-            this.MaximumSize = new System.Drawing.Size(910, 581);
-            this.MinimumSize = new System.Drawing.Size(910, 581);
-            this.Name = "Form_MaxEDSRules";
-            this.ShowIcon = false;
-            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
-            this.Text = "Form_MaxEDSRules";
-            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_MaxEDSRules_FormClosing);
-            this.Load += new System.EventHandler(this.Form_MaxEDSRules_Load);
-            this.XmlTreeMenuStrip.ResumeLayout(false);
-            this.groupBox_CalculatingSymbols.ResumeLayout(false);
-            this.groupBox_Data.ResumeLayout(false);
-            this.groupBox_XmlTree_MaxEDSRules.ResumeLayout(false);
-            this.groupBox_XmlTree_MaxEDSRules.PerformLayout();
-            this.groupBox_ChemicalElement.ResumeLayout(false);
-            this.groupBox_OtherCommonlyUsedSymbols.ResumeLayout(false);
-            this.groupBox_OtherCommonlyUsedSymbols.PerformLayout();
-            this.ResumeLayout(false);
-            this.PerformLayout();
-
-        }
-
-        #endregion
-
-
-        private System.Windows.Forms.ContextMenuStrip XmlTreeMenuStrip;
-        private System.Windows.Forms.ToolStripMenuItem 新建标准库规则ToolStripMenuItem;
-        private System.Windows.Forms.ToolStripMenuItem 删除ToolStripMenuItem;
-        private System.Windows.Forms.TreeView XmlTree_MaxEDSRules;
-        private System.Windows.Forms.Button button_Cancel;
-        private System.Windows.Forms.TextBox textbox_STDEditor;
-        private System.Windows.Forms.Button button_Ok;
-        private System.Windows.Forms.Button button_0;
-        private System.Windows.Forms.Button button_9;
-        private System.Windows.Forms.Button button_4;
-        private System.Windows.Forms.Button button_5;
-        private System.Windows.Forms.Button button_6;
-        private System.Windows.Forms.Button button_7;
-        private System.Windows.Forms.Button button_8;
-        private System.Windows.Forms.Button button_Divide;
-        private System.Windows.Forms.Button button_Or;
-        private System.Windows.Forms.Button button_And;
-        private System.Windows.Forms.Button button_3;
-        private System.Windows.Forms.Button button_2;
-        private System.Windows.Forms.Button button_1;
-        private System.Windows.Forms.Button button_Equal;
-        private System.Windows.Forms.Button button_RightParenthesis;
-        private System.Windows.Forms.Button button_LeftParenthesis;
-        private System.Windows.Forms.Button button_Less;
-        private System.Windows.Forms.Button button_More;
-        private System.Windows.Forms.Button button_Multiply;
-        private System.Windows.Forms.GroupBox groupBox_CalculatingSymbols;
-        private System.Windows.Forms.Button button_Subtract;
-        private System.Windows.Forms.Button button_Plus;
-        private System.Windows.Forms.GroupBox groupBox_Data;
-        private System.Windows.Forms.GroupBox groupBox_XmlTree_MaxEDSRules;
-        private System.Windows.Forms.TextBox textBox_MaxEDSTime;
-        private System.Windows.Forms.Button button_Recover;
-        private System.Windows.Forms.GroupBox groupBox_ChemicalElement;
-        private System.Windows.Forms.ComboBox comboBox_PeriodicTable;
-        private System.Windows.Forms.GroupBox groupBox_OtherCommonlyUsedSymbols;
-        private System.Windows.Forms.ComboBox comboBox_Constants;
-        private System.Windows.Forms.Label label_DefinedConstant;
-        private System.Windows.Forms.Label label_Other;
-        private System.Windows.Forms.Label label_ElementFormTwo;
-        private System.Windows.Forms.Label label_ElementFormOne;
-        private System.Windows.Forms.ComboBox comboBox_Elem1;
-        private System.Windows.Forms.ComboBox comboBox_Elem;
-        private System.Windows.Forms.ComboBox comboBox_ImgProperty;
-        private System.Windows.Forms.Button PeriodicTableSwitch;
-        private System.Windows.Forms.Label label1;
-    }
-}

+ 0 - 1406
OTSPartA_STDEditor/UI/Form_MaxEDSRules.cs

@@ -1,1406 +0,0 @@
-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.Windows.Forms;
-using System.Xml;
-using System.Xml.Linq;
-
-namespace OTSPartA_STDEditor
-{
-    public partial class Form_MaxEDSRules : Form
-    {
-        //国际化
-        Language lan;
-        System.Collections.Hashtable table;
-        
-        string STDDBAddress = Application.StartupPath + "\\Config\\SysData\\" + "OTSCleanlinesSTD.db";
-        //string STDDBAddress_backup = Application.StartupPath + "\\Config\\SysData\\LibBackup\\" + "OTSCleanlinesSTD_backup.db";
-        string STDDBAddress_backupDirectory = Application.StartupPath + "\\Config\\SysData\\LibBackup\\";
-
-        //元素周期表
-        Form_PeriodicTable form_PeriodicTable=null;
-
-        public Form_MaxEDSRules(string DBAddress)
-        {
-            InitializeComponent();
-            STDDBAddress = DBAddress;
-
-            //X = this.Width;
-            //Y = this.Height;
-            //setTag(this);
-        }
-
-        private void Form_MaxEDSRules_Load(object sender, EventArgs e)
-        {
-            
-            //初始化comboBox
-            this.comboBox_Elem1.Items.Add("first_elem");
-            this.comboBox_Elem1.Items.Add("second_elem");
-            this.comboBox_Elem1.Items.Add("third_elem");
-            this.comboBox_Elem1.Items.Add("fourth_elem");
-            this.comboBox_Elem1.Items.Add("fifth_elem");
-            this.comboBox_Elem1.Items.Add("sixth_elem");
-            this.comboBox_Elem1.Items.Add("seventh_elem");
-            this.comboBox_Elem1.Items.Add("eighth_elem");
-            this.comboBox_Elem1.Items.Add("ninth_elem");
-            this.comboBox_Elem1.Items.Add("tenth_elem");
-            comboBox_Elem1.SelectedIndex = comboBox_Elem1.Items.IndexOf("first_elem");
-
-            this.comboBox_Elem.Items.Add("Element#1");
-            this.comboBox_Elem.Items.Add("Element#2");
-            this.comboBox_Elem.Items.Add("Element#3");
-            this.comboBox_Elem.Items.Add("Element#4");
-            this.comboBox_Elem.Items.Add("Element#5");
-            this.comboBox_Elem.Items.Add("Element#6");
-            this.comboBox_Elem.Items.Add("Element#7");
-            this.comboBox_Elem.Items.Add("Element#8");
-            this.comboBox_Elem.Items.Add("Element#9");
-            this.comboBox_Elem.Items.Add("Element#10");
-            comboBox_Elem.SelectedIndex = comboBox_Elem.Items.IndexOf("Element#1");
-
-            this.comboBox_ImgProperty.Items.Add("Dmax");
-            this.comboBox_ImgProperty.Items.Add("Dmin");
-            this.comboBox_ImgProperty.Items.Add("Aspect");
-            this.comboBox_ImgProperty.Items.Add("Dperp");
-            this.comboBox_ImgProperty.Items.Add("Dmean");
-            this.comboBox_ImgProperty.Items.Add("Area");
-            this.comboBox_ImgProperty.Items.Add("Dferet");
-            this.comboBox_ImgProperty.Items.Add("With");
-            this.comboBox_ImgProperty.Items.Add("Height");
-            this.comboBox_ImgProperty.Items.Add("Perimeter");
-            this.comboBox_ImgProperty.Items.Add("Dinscr");
-            this.comboBox_ImgProperty.Items.Add("Orientation");
-            this.comboBox_ImgProperty.Items.Add("Delong");
-            this.comboBox_ImgProperty.Items.Add("Aspectelong");
-            this.comboBox_ImgProperty.Items.Add("Dequalcircle");
-            this.comboBox_ImgProperty.Items.Add("Vedio");
-
-            comboBox_ImgProperty.SelectedIndex = comboBox_ImgProperty.Items.IndexOf("Dmax");
-
-
-            string[] PeriodicTable = { "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hq", "TI", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Mc", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Unb" };
-            comboBox_PeriodicTable.Items.AddRange(PeriodicTable);
-            AutoCompleteStringCollection sc = new AutoCompleteStringCollection();
-            sc.AddRange(PeriodicTable);
-            this.comboBox_PeriodicTable.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
-            this.comboBox_PeriodicTable.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
-            this.comboBox_PeriodicTable.AutoCompleteCustomSource = sc;
-            LoadMaxEDSRulesToTreeControl(STDDBAddress, XmlTree_MaxEDSRules.Nodes);
-            LoadConstants(STDDBAddress);
-            this.textbox_STDEditor.Text = "";
-
-            lan = new Language(this);
-            table = lan.GetNameTable("Form_MaxEDSRules");
-
-            if (table["language"].ToString() == "EN")
-            {
-                //panel_OTSPeriodicTable.BackgroundImage = global::OTSPartA_STDEditor.Properties.Resources.PeriodicTable_EN;
-                PeriodicTableSwitch.BackgroundImage = global::OTSPartA_STDEditor.Properties.Resources.STDEditoName;
-                PeriodicTableSwitch.Text = "";
-            }
-            else
-            {
-                //panel_OTSPeriodicTable.BackgroundImage = global::OTSPartA_STDEditor.Properties.Resources.PeriodicTable_ZH;
-                PeriodicTableSwitch.Text = "元素周期表";
-            }
-
-            //panel_OTSPeriodicTable.Visible = true;
-            //this.Width = this.Width - panel_OTSPeriodicTable.Width - 5;
-
-            Size size = Screen.PrimaryScreen.WorkingArea.Size;
-            Left = (size.Width - Width) / 2;
-            Top = (size.Height - Height) / 2;
-            WindowState = FormWindowState.Normal;
-
-            //groupBox_XmlTree_MaxEDSRules.Focus();
-            this.XmlTree_MaxEDSRules.HideSelection = false;//失去焦点后不隐藏选中节点
-            XmlTree_MaxEDSRules.Focus();
-            if (XmlTree_MaxEDSRules.Nodes.Count > 0)
-            {
-                XmlTree_MaxEDSRules.SelectedNode = XmlTree_MaxEDSRules.Nodes[0];
-                XmlTree_MaxEDSRules_AfterSelect(XmlTree_MaxEDSRules, new TreeViewEventArgs(XmlTree_MaxEDSRules.SelectedNode));
-            }
-        }
-       
-
-        //XmlTree_MaxEDSRules
-        void LoadXmlToTreeControl(XmlDocument xml,TreeNodeCollection XmlTree_MaxEDSRules)
-        {
-            XmlNode root = xml.SelectSingleNode("XMLData");
-            XmlNodeList root2 = root.SelectNodes("Collection");
-            for (int j = 0; j < root2.Count; j++)
-            {
-                if (root2[j].Attributes["RegName"].Value.ToString() == "MaxEDSRules")
-                {
-                    XmlNodeList childlist = root2[j].ChildNodes;
-                    if (childlist.Count != 0)
-                    {
-                        for (int i = 0; i < childlist.Count; i++)
-                        {
-                            TreeNode new_child = new TreeNode();//定义一个TreeNode节点对象
-                                                                //new_child.Name = childlist[i].Attributes["MaxEDSTime"].Value;
-                            new_child.Tag = childlist[i].Attributes["Expression"].Value;
-                            new_child.Text = "Rule" + i.ToString();
-                            XmlTree_MaxEDSRules.Add(new_child);
-                        }
-                        if (childlist[0].Attributes["MaxEDSTime"] != null)
-                        {
-                            textBox_MaxEDSTime.Text = childlist[0].Attributes["MaxEDSTime"].Value;
-                        }
-                    }
-                }
-            }
-
-            XmlNode root3 = root.SelectSingleNode("Member");
-            string ConstantsStr = root3.Attributes["value"].Value;
-            ConstantsStr = ConstantsStr.Replace(" ", "");
-            string[] ConstantsStr2 = ConstantsStr.Split(',');
-            this.comboBox_Constants.Items.Clear();
-            this.comboBox_Constants.Items.AddRange(ConstantsStr2);
-        }
-
-        void LoadMaxEDSRulesToTreeControl(string DBAddress, TreeNodeCollection XmlTree_MaxEDSRules)
-        {
-            try
-            {
-                System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + DBAddress + "'");
-                m_dbConnection.Open();
-                System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from MaxEDSRules", m_dbConnection);
-                DataSet ds = new DataSet();
-                m_dataAdapter.Fill(ds);
-                DataTable dt = ds.Tables[0];
-
-                if (dt != null)
-                {
-                    if (dt.Rows.Count > 0)
-                    {
-                        int i = 1;
-                        foreach (DataRow item in dt.Rows)
-                        {
-                            TreeNode new_child = new TreeNode();//定义一个TreeNode节点对象
-                            new_child.Tag = item["Expression"].ToString();
-                            new_child.Text = "Rule" + i.ToString();
-                            XmlTree_MaxEDSRules.Add(new_child);
-                            i++;
-                        }
-                        if (dt.Rows[0]["MaxEDSTime"] != null)
-                        {
-                            textBox_MaxEDSTime.Text = dt.Rows[0]["MaxEDSTime"].ToString();
-                        }
-                    }
-                }
-            }
-            catch (Exception ee)
-            {
-                MessageBox.Show(ee.ToString());
-            }
-        }
-
-        void LoadConstants(string STDDBAddress)
-        {
-            try
-            {
-                System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + STDDBAddress + "'");
-                m_dbConnection.Open();
-                System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from Constants", m_dbConnection);
-                DataSet ds = new DataSet();
-                m_dataAdapter.Fill(ds);
-                DataTable dt = ds.Tables[0];
-                string ConstantsStr = "";
-                if (dt.Rows.Count > 0)
-                {
-                    ConstantsStr = dt.Rows[0][0].ToString();
-                }
-                ConstantsStr = ConstantsStr.Replace(" ", "");
-                string[] ConstantsStr2 = ConstantsStr.Split(',');
-                comboBox_Constants.Items.Clear();
-                comboBox_Constants.Items.AddRange(ConstantsStr2);
-                m_dbConnection.Close();
-            }
-            catch (Exception ee)
-            {
-                MessageBox.Show(ee.ToString());
-            }
-        }
-
-        private void comboBox_Elem1_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            string newStr = comboBox_Elem1.SelectedItem.ToString();
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, newStr);
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + newStr.Length, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void comboBox_Elem2_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            string newStr = comboBox_Elem.SelectedItem.ToString();
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, newStr);
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + newStr.Length, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void comboBox_ImgProperty_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            string newStr = comboBox_ImgProperty.SelectedItem.ToString();
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, newStr);
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + newStr.Length, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_Plus_Click(object sender, EventArgs e)
-        {
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "+");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index+1,0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_Subtract_Click(object sender, EventArgs e)
-        {
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "-");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_Multiply_Click(object sender, EventArgs e)
-        {
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "*");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_Divide_Click(object sender, EventArgs e)
-        {
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "/");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret(); ;
-        }
-
-        private void button_More_Click(object sender, EventArgs e)
-        {
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, ">");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_Less_Click(object sender, EventArgs e)
-        {
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "<");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_LeftParenthesis_Click(object sender, EventArgs e)
-        {
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "(");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_RightParenthesis_Click(object sender, EventArgs e)
-        {
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, ")");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_Equal_Click(object sender, EventArgs e)
-        {
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "=");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        //除选中点以外其它节点前景色置灰
-        private void SetGrayExceptSelectedNode(TreeView Tree, TreeNode SelectedNode)
-        {
-            foreach (TreeNode node in Tree.Nodes)
-            {
-                if (node != SelectedNode)
-                {
-                    node.ForeColor = Color.Gray;
-                }
-            }
-        }
-        //恢复所有节点颜色为可用
-        private void SetBlackAllNodes(TreeView Tree)
-        {
-            foreach (TreeNode node in Tree.Nodes)
-            {
-                node.ForeColor = Color.Black;
-            }
-        }
-        //删除
-        private void DeleteTreeNode_Click(object sender, EventArgs e)
-        {
-            try
-            {
-                TreeView XmlTree = (TreeView)XmlTreeMenuStrip.SourceControl;
-                if (XmlTree.SelectedNode != null)
-                {
-                    if (XmlTree != null)
-                    { 
-                        if (XmlTree.SelectedNode.NextNode != null)
-                        {
-                            TreeNode Temp = XmlTree.SelectedNode.NextNode;
-                            XmlTree.SelectedNode.Remove();
-                            XmlTree.SelectedNode = Temp;
-                        }
-                        else if (XmlTree.SelectedNode.PrevNode != null)
-                        {
-                            TreeNode Temp = XmlTree.SelectedNode.PrevNode;
-                            XmlTree.SelectedNode.Remove();
-                            XmlTree.SelectedNode = Temp;
-                        }
-                        else 
-                        {
-                            XmlTree.SelectedNode.Remove();
-                            XmlTree.SelectedNode = null;
-                            if (XmlTree.Name == "XmlTree_MaxEDSRules")
-                            {
-                                textbox_STDEditor.Text = "";
-                                textBox_MaxEDSTime.Text = "";
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    MessageBox.Show("No nodes are selected!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                }
-            }
-            catch (Exception ex)
-            {
-                MessageBox.Show(ex.ToString(), "Tip");
-            }
-        }
-
-        //新建
-        private void AddTreeNode_Click(object sender, EventArgs e)
-        {
-            try
-            {
-                if (XmlTree_MaxEDSRules.SelectedNode != null)
-                {
-                    //判断MaxEDSTime
-                    double dMaxEDSTime = 0;
-                    if (!double.TryParse(textBox_MaxEDSTime.Text, out dMaxEDSTime) || double.Parse(textBox_MaxEDSTime.Text) <= 0)
-                    {
-                        MessageBox.Show("The MaxEDSTime of current selected node input error, please enter the correct format!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                        return;
-                    }
-                    //判断textbox_STDEditor
-                    if (!Checktextbox_STDEditor())
-                    {
-                        return;
-                    }
-                    XmlTree_MaxEDSRules.SelectedNode.Tag = this.textbox_STDEditor.Text;
-                }
-
-                TreeNode new_child = new TreeNode();//定义一个TreeNode节点对象
-                TreeView XmlTree = (TreeView)XmlTreeMenuStrip.SourceControl;
-                
-                if (XmlTreeMenuStrip.SourceControl.Name == "XmlTree_MaxEDSRules")
-                {
-                    int Number = XmlTree.Nodes.Count;
-                    for (int num = 0; num < XmlTree.Nodes.Count; num++)
-                    {
-                        string aa = XmlTree.Nodes[num].Text.ToString().Substring(XmlTree.Nodes[num].Text.Length - 1, 1);
-                        int tp = int.Parse(XmlTree.Nodes[num].Text.ToString().Substring(XmlTree.Nodes[num].Text.Length - 1, 1));
-                        if (Number < tp) Number = tp;
-                    }
-                    new_child.Text = "Rule" + Number.ToString();
-                    new_child.Tag = "false";
-                    textbox_STDEditor.Text = "false";
-                    textBox_MaxEDSTime.Text = "200";
-                }
-                
-                XmlTree.Nodes.Add(new_child);
-                XmlTree.SelectedNode = null;
-                XmlTree.SelectedNode = new_child;
-            }
-            catch (Exception ex)
-            {
-                MessageBox.Show(ex.ToString(), "Tip");
-            }
-        }
-
-
-        void SaveXmlTreeDataToMaxEDSRules(string DBAddress)
-        {
-            System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + DBAddress + "'");
-            m_dbConnection.Open();
-
-            System.Data.SQLite.SQLiteCommand cmm = m_dbConnection.CreateCommand();
-            cmm.CommandText = "delete from MaxEDSRules";
-
-            try
-            {
-                cmm.ExecuteNonQuery();
-            }
-            catch (Exception ex)
-            {
-                MessageBox.Show(ex.ToString());
-            }
-            System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from MaxEDSRules", m_dbConnection);
-            System.Data.SQLite.SQLiteCommandBuilder qLiteCommandBuilder = new System.Data.SQLite.SQLiteCommandBuilder(m_dataAdapter);
-
-            DataSet ds = new DataSet();
-            m_dataAdapter.Fill(ds, "MaxEDSRules");
-            DataTable dt = ds.Tables["MaxEDSRules"];
-
-            dt.Clear();
-
-            for (int num = 0; num < XmlTree_MaxEDSRules.Nodes.Count; num++)
-            {
-                string UsingElementList = "";
-                string UsingImgPropertyList = "";
-                string UsingOtherPropertyList = "";
-                List<string> UsingElementL = new List<string>();
-                List<string> UsingImgPropertyL = new List<string>();
-                List<string> UsingOtherPropertyL = new List<string>();
-
-                string str_RemoveBlank = "";
-                //forth_elem干扰or分隔符,故先行去掉
-                //if (XmlTree_MaxEDSRules.Nodes[num].Tag.ToString().Contains("fourth_elem"))
-                //{
-                //    str_RemoveBlank = str_RemoveBlank.Replace("fourth_elem", "");
-                //    UsingOtherPropertyList = "fourth_elem,";
-                //}
-
-                str_RemoveBlank = XmlTree_MaxEDSRules.Nodes[num].Tag.ToString().Replace(" ", "");
-                string[] str_Removeand = System.Text.RegularExpressions.Regex.Split(str_RemoveBlank, "and", System.Text.RegularExpressions.RegexOptions.None);
-                List<string> str_Removeandor = new List<string>();
-                for (int i = 0; i < str_Removeand.Length; i++)
-                {
-                    str_Removeandor.AddRange(System.Text.RegularExpressions.Regex.Split(str_Removeand[i], "or", System.Text.RegularExpressions.RegexOptions.None));
-                }
-                List<string> list_all = new List<string>();
-                for (int i = 0; i < str_Removeandor.Count; i++)
-                {
-                    list_all.AddRange(str_Removeandor[i].Split(new char[] { '+', '-', '*', '/', '=', '>', '<', '(', ')' }));
-                }
-                for (int i = 0; i < list_all.Count; i++)
-                {
-                    //周期元素?
-                    if (this.comboBox_PeriodicTable.Items.Contains(list_all[i]))
-                    {
-                        if (!UsingElementL.Contains(list_all[i]))
-                        {
-                            UsingElementL.Add(list_all[i]);
-                        }
-                    }
-                    //first_elem?
-                    if (this.comboBox_Elem1.Items.Contains(list_all[i]))
-                    {
-                        if (!UsingOtherPropertyL.Contains(list_all[i]))
-                        {
-                            UsingOtherPropertyL.Add(list_all[i]);
-                        }
-                    }
-                    //Element1?
-                    if (this.comboBox_Elem.Items.Contains(list_all[i]))
-                    {
-                        if (!UsingOtherPropertyL.Contains(list_all[i]))
-                        {
-                            UsingOtherPropertyL.Add(list_all[i]);
-                        }
-                    }
-                    //其它元素?
-                    if (this.comboBox_ImgProperty.Items.Contains(list_all[i]))
-                    {
-                        if (!UsingImgPropertyL.Contains(list_all[i]))
-                        {
-                            UsingImgPropertyL.Add(list_all[i]);
-                        }
-                    }
-
-                }
-
-                if (UsingElementL.Count > 0)
-                {
-                    for (int i = 0; i < UsingElementL.Count - 1; i++)
-                    {
-                        UsingElementList += UsingElementL[i] + ",";
-                    }
-                    UsingElementList += UsingElementL[UsingElementL.Count - 1];
-                }
-
-                if (UsingImgPropertyL.Count > 0)
-                {
-                    for (int i = 0; i < UsingImgPropertyL.Count - 1; i++)
-                    {
-                        UsingImgPropertyList += UsingImgPropertyL[i] + ",";
-                    }
-                    UsingImgPropertyList += UsingImgPropertyL[UsingImgPropertyL.Count - 1];
-                }
-
-                if (UsingOtherPropertyL.Count > 0)
-                {
-                    for (int i = 0; i < UsingOtherPropertyL.Count - 1; i++)
-                    {
-                        UsingOtherPropertyList += UsingOtherPropertyL[i] + ",";
-                    }
-                    UsingOtherPropertyList += UsingOtherPropertyL[UsingOtherPropertyL.Count - 1];
-                }
-
-                DataRow newRow = dt.NewRow();
-                newRow["MaxEDSTime"] = int.Parse(textBox_MaxEDSTime.Text);
-                newRow["UsingElementList"] = UsingElementList;
-                newRow["UsingImgPropertyList"] = UsingImgPropertyList;
-                newRow["UsingOtherPropertyList"] = UsingOtherPropertyList;
-                newRow["Expression"] = XmlTree_MaxEDSRules.Nodes[num].Tag;
-                dt.Rows.Add(newRow);
-            }
-            m_dataAdapter.Update(ds, "MaxEDSRules");
-            m_dbConnection.Close();
-
-            MessageBox.Show("Save successful!", "Tip");
-        }
-
-        //元素周期表开关
-        private void PeriodicTableSwitch_Click(object sender, EventArgs e)
-        {
-            //if (PeriodicTableSwitch.BackColor == SystemColors.Control)
-            //{
-            //    //this.Resize -= new System.EventHandler(this.Form_MaxEDSRules_Resize);
-            //    panel_OTSPeriodicTable.Visible = false;
-            //    this.Width = this.Width - panel_OTSPeriodicTable.Width;
-            //    //this.Resize += new System.EventHandler(this.Form_MaxEDSRules_Resize);
-            //    PeriodicTableSwitch.BackColor = SystemColors.ControlDark;
-
-            //    //if (Language == "English")
-            //    //{
-            //    //    PeriodicTableSwitch.Text = "Close PeriodicTable";
-            //    //}
-            //    //else if(Language == "Chinese")
-            //    //{
-            //    //    PeriodicTableSwitch.Text = "关闭元素周期表";
-            //    //}
-
-            //}
-            //else if (PeriodicTableSwitch.BackColor == SystemColors.ControlDark)
-            //{
-            //    //this.Resize -= new System.EventHandler(this.Form_MaxEDSRules_Resize);
-            //    //this.Width = this.Width + panel_OTSPeriodicTable.Width + 5;
-            //    panel_OTSPeriodicTable.Visible = true;
-            //    //this.Resize += new System.EventHandler(this.Form_MaxEDSRules_Resize);
-
-            //    PeriodicTableSwitch.BackColor = SystemColors.Control;
-
-            //    //if (Language == "English")
-            //    //{
-            //    //    PeriodicTableSwitch.Text = "Open PeriodicTable";
-            //    //}
-            //    //else if (Language == "Chinese")
-            //    //{
-            //    //    PeriodicTableSwitch.Text = "打开元素周期表";
-            //    //}
-
-            //    //textbox_STDEditor.Focus();
-
-            //    groupBox_CalculatingSymbols.Focus();
-            //}
-
-            if (form_PeriodicTable == null)
-            {
-                form_PeriodicTable = new Form_PeriodicTable();
-                form_PeriodicTable.Show();
-                form_PeriodicTable.Location = new Point(this.Location.X + this.Width - 14, this.Location.Y);
-            }
-            else
-            {
-                if (form_PeriodicTable.IsDisposed)
-                {
-                    form_PeriodicTable = new Form_PeriodicTable();
-                    form_PeriodicTable.Show();
-                    form_PeriodicTable.Location = new Point(this.Location.X + this.Width - 14, this.Location.Y);
-                }
-                else
-                {
-                    form_PeriodicTable.Activate();
-                }
-            }
-
-        }
-
-        private void button_Ok_Click(object sender, EventArgs e)
-        {
-            if (XmlTree_MaxEDSRules.SelectedNode != null)
-            {
-                //判断MaxEDSTime
-                double dMaxEDSTime = 0;
-                if (!double.TryParse(textBox_MaxEDSTime.Text, out dMaxEDSTime) || double.Parse(textBox_MaxEDSTime.Text) <= 0)
-                {
-                    textBox_MaxEDSTime.Focus();
-                    textBox_MaxEDSTime.SelectAll();
-                    MessageBox.Show("The Item of MaxEDSTime input error, please enter the correct format!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                    return;
-                }
-                //判断textbox_STDEditor
-                if (!Checktextbox_STDEditor())
-                {
-                    return;
-                }
-                XmlTree_MaxEDSRules.SelectedNode.Tag = this.textbox_STDEditor.Text;
-                //XmlTree_MaxEDSRules.SelectedNode.Name = textBox_MaxEDSTime.Text;
-            }
-            SaveXmlTreeDataToMaxEDSRules(STDDBAddress);
-
-            this.Close(); 
-        }
-
-        private void button_Cancel_Click(object sender, EventArgs e)
-        {
-            this.Close();
-        }
-
-        //元素下拉选择输入
-        private void comboBox_PeriodicTable_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            if (comboBox_PeriodicTable.Text != null && comboBox_PeriodicTable.SelectedItem != null)
-            {
-                string newStr = comboBox_PeriodicTable.SelectedItem.ToString();
-                comboBox_PeriodicTable.Text = null;
-                int index = textbox_STDEditor.SelectionStart;
-                textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, newStr);
-                textbox_STDEditor.Focus();
-                textbox_STDEditor.Select(index + newStr.Length, 0);
-                textbox_STDEditor.ScrollToCaret();
-            }
-        }
-
-        //元素自身text按回车键输入
-        private void comboBox_PeriodicTable_KeyDown(object sender, KeyEventArgs e)
-        {
-            if (e.KeyValue == 13)
-            {
-                if (comboBox_PeriodicTable.Text != null && comboBox_PeriodicTable.Text != "")
-                {
-                    this.textbox_STDEditor.Text += comboBox_PeriodicTable.Text.ToString();
-                    comboBox_PeriodicTable.Text = null;
-                }
-            }
-        }
-
-        //表达式规则检查
-        private bool Checktextbox_STDEditor()
-        {
-            if (textbox_STDEditor.Text == "" || textbox_STDEditor.Text == null)
-            {
-                textBox_MaxEDSTime.Focus();
-                MessageBox.Show("The content of Standard library cannot be empty!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                return false;
-            }
-            string str_RemoveBlank = textbox_STDEditor.Text.ToString().Replace(" ", "");
-            str_RemoveBlank = str_RemoveBlank.Replace("\r\n", "");
-            //分割符号检验
-            string[] Symbol = { "and", "or", "+", "-", "*", "/", "=", ">", "<" };
-            for (int i = 0; i < Symbol.Length; i++)
-            {
-                for (int j = 0; j < Symbol.Length; j++)
-                {
-                    if ((Symbol[i] + Symbol[j]) != ">=" && (Symbol[i] + Symbol[j]) != "<=")
-                    {
-                        if (str_RemoveBlank.Contains(Symbol[i] + Symbol[j]))
-                        {
-                            MessageBox.Show("Invalid string exists:" + Symbol[i] + Symbol[j], "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                            return false;
-                        }
-                    }
-                }
-                if (str_RemoveBlank.Contains(Symbol[i] + ")") || str_RemoveBlank.Contains("(" + Symbol[i]))
-                {
-                    MessageBox.Show("Invalid string exists:" + Symbol[i] + ")", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                    return false;
-                }
-                if (str_RemoveBlank.Contains("(" + Symbol[i]))
-                {
-                    MessageBox.Show("Invalid string exists:" + "(" + Symbol[i], "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                    return false;
-                }
-            }
-            if ((str_RemoveBlank != null) && (str_RemoveBlank != ""))
-            {
-                //左右括号匹配检验
-                int BracketsNum = 0;
-                for (int i = 0; i < str_RemoveBlank.Length; i++)
-                {
-                    if (str_RemoveBlank[i] == '(') BracketsNum++;
-                    if (str_RemoveBlank[i] == ')') BracketsNum--;
-                }
-                if (BracketsNum != 0)
-                {
-                    MessageBox.Show("Number of left and right parentheses does not match!", "Tip", MessageBoxButtons.OK,MessageBoxIcon.Information);
-                    return false;
-                }
-                //首字符检测
-                if ((str_RemoveBlank[0] == '+') || (str_RemoveBlank[0] == '-') || (str_RemoveBlank[0] == '*') || (str_RemoveBlank[0] == '/') || (str_RemoveBlank[0] == '>') || (str_RemoveBlank[0] == '<') || (str_RemoveBlank[0] == '=') || (str_RemoveBlank[0] == ')') || (str_RemoveBlank[str_RemoveBlank.Length - 1] == '('))
-                {
-                    MessageBox.Show("First character is error!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                    return false;
-                }
-
-                if (str_RemoveBlank.Length >= 3)
-                {
-                    if ((str_RemoveBlank.Substring(0, 3) == "and") || (str_RemoveBlank.Substring(0, 3) == "end"))
-                    {
-                        MessageBox.Show("First character is error!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                        return false;
-                    }
-                }
-            }
-
-            //forth_elem干扰or分隔符,故先行去掉
-            //str_RemoveBlank = str_RemoveBlank.Replace("fourth_elem", "");
-
-            string[] str_Removeand = System.Text.RegularExpressions.Regex.Split(str_RemoveBlank, "and", System.Text.RegularExpressions.RegexOptions.None);
-            List<string> str_Removeandor = new List<string>();
-            for (int i = 0; i < str_Removeand.Length; i++)
-            {
-                str_Removeandor.AddRange(System.Text.RegularExpressions.Regex.Split(str_Removeand[i], "or", System.Text.RegularExpressions.RegexOptions.None));
-            }
-            List<string> list_all = new List<string>();
-            for (int i = 0; i < str_Removeandor.Count; i++)
-            {
-                list_all.AddRange(str_Removeandor[i].Split(new char[] { '+', '-', '*', '/', '=', '>', '<', '(', ')' }));
-            }
-
-            //常量
-            List<string> Constantslist = new List<string>();
-            for (int j = 0; j < comboBox_Constants.Items.Count; j++)
-            {
-                Constantslist.Add(comboBox_Constants.Items[j].ToString().Split('=')[0]);
-            }
-
-            for (int i = 0; i < list_all.Count; i++)
-            {
-                //周期元素?
-                if (this.comboBox_PeriodicTable.Items.Contains(list_all[i]))
-                {
-                    continue;
-                }
-                //first_elem?
-                if (this.comboBox_Elem1.Items.Contains(list_all[i]))
-                {
-                    continue;
-                }
-                //Element1?
-                if (this.comboBox_Elem.Items.Contains(list_all[i]))
-                {
-                    continue;
-                }
-                //其它元素?
-                if (this.comboBox_ImgProperty.Items.Contains(list_all[i]))
-                {
-                    continue;
-                }
-                //常量?
-                if (Constantslist.Contains(list_all[i]))
-                {
-                    continue;
-                }
-                //数字?
-                double DNum = 0;
-                if (double.TryParse(list_all[i], out DNum))
-                {
-                    continue;
-                }
-                //>=? <=?等其它情况
-                if (list_all[i] == "")
-                {
-                    continue;
-                }
-                //true false?
-                if ((list_all[i] == "true") || (list_all[i] == "false"))
-                {
-                    continue;
-                }
-
-                MessageBox.Show("Please check whether the input rules are correct, error characters:" + list_all[i], "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                return false;
-            }
-
-            //检测是否有<>= true,false
-            if (!textbox_STDEditor.Text.ToString().Contains("<") && !textbox_STDEditor.Text.ToString().Contains(">") && !textbox_STDEditor.Text.ToString().Contains("=")&& textbox_STDEditor.Text.ToString()!="true"&& textbox_STDEditor.Text.ToString() != "false")
-            {
-                MessageBox.Show("Expressions have no effect!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                return false;
-            }
-
-            return true;
-        }
-
-        
-
-        private void button_And_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "and");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 3, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_Or_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "or");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 2, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void comboBox_Constants_SelectedIndexChanged(object sender, EventArgs e)
-        {
-                if (comboBox_Constants.SelectedItem != null)
-                {
- 
-                    string newStr = comboBox_Constants.SelectedItem.ToString().Split('=')[0];
-                    int index = textbox_STDEditor.SelectionStart;
-                    textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, newStr);
-                    textbox_STDEditor.Focus();
-                    textbox_STDEditor.Select(index + newStr.Length, 0);
-                    textbox_STDEditor.ScrollToCaret();
-                }
-        }
-
-        private void button_Recover_Click(object sender, EventArgs e)
-        {
-            XmlDocument doc = new XmlDocument();
-
-            try
-            {
-                //System.IO.File.Copy(Address_backup, Address, true);
-                //doc.Load(Address_backup);
-                //LoadXmlToTreeControl(doc, XmlTree_MaxEDSRules.Nodes);
-                XmlTree_MaxEDSRules.Nodes.Clear();
-
-                string STDDBAddress_backup = "";
-                string[] files = System.IO.Directory.GetFiles(STDDBAddress_backupDirectory);//得到文件
-                foreach (var file in files)
-                {
-                    if (".db".IndexOf(file.Substring(file.LastIndexOf(".") + 1)) > -1)
-                    {
-                        STDDBAddress_backup = file;
-                    }
-                }
-                LoadMaxEDSRulesToTreeControl(STDDBAddress_backup, XmlTree_MaxEDSRules.Nodes);
-
-                XmlTree_MaxEDSRules.Focus();
-                if (XmlTree_MaxEDSRules.Nodes.Count > 0)
-                {
-                    XmlTree_MaxEDSRules.SelectedNode = XmlTree_MaxEDSRules.Nodes[0];
-                    XmlTree_MaxEDSRules_AfterSelect(XmlTree_MaxEDSRules, new TreeViewEventArgs(XmlTree_MaxEDSRules.SelectedNode));
-                }
-                else
-                {
-                    textbox_STDEditor.Text = "";
-                    textBox_MaxEDSTime.Text = "";
-                }
-
-            }
-            catch(Exception ex)
-            {
-                MessageBox.Show("Recovery failed!" + "\n"+ex.Message.ToString(), "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-            }
-        }
-
-        private bool CheckConstants(string ConstantName)
-        {
-            
-            for (int num = 0; num < XmlTree_MaxEDSRules.Nodes.Count; num++)
-            {
-                if (XmlTree_MaxEDSRules.Nodes[num].Tag.ToString().Contains(ConstantName))
-                {
-                    XmlTree_MaxEDSRules.SelectedNode = XmlTree_MaxEDSRules.Nodes[num];
-                    SetGrayExceptSelectedNode(XmlTree_MaxEDSRules, XmlTree_MaxEDSRules.SelectedNode);
-                    DialogResult result = MessageBox.Show("Closing failed," + XmlTree_MaxEDSRules.Nodes[num].Text + table["message28"].ToString(), "Tip", MessageBoxButtons.OK, MessageBoxIcon.Warning);
-                    return false;
-                }
-            }
-            
-            return true;
-        }
-
-        private void XmlTree_MaxEDSRules_AfterSelect(object sender, TreeViewEventArgs e)
-        {
-            SetBlackAllNodes(XmlTree_MaxEDSRules);
-            this.textbox_STDEditor.Text = XmlTree_MaxEDSRules.SelectedNode.Tag.ToString();
-        }
-
-        private void XmlTree_MaxEDSRules_BeforeSelect(object sender, TreeViewCancelEventArgs e)
-        {
-            if (XmlTree_MaxEDSRules.SelectedNode != null)
-            {
-                if (!Checktextbox_STDEditor())
-                {
-                    SetGrayExceptSelectedNode(XmlTree_MaxEDSRules, XmlTree_MaxEDSRules.SelectedNode);
-                    e.Cancel = true;
-                    return;
-                }
-                XmlTree_MaxEDSRules.SelectedNode.Tag = this.textbox_STDEditor.Text;
-            }
-        }
-
-        private void textbox_STDEditor_Leave(object sender, EventArgs e)
-        {
-            XmlTree_MaxEDSRules.Focus();
-        }
-        
-		 #region  为配合textbox_STDEditor_Leave时事件,点击其它groupbox组件时使焦点转移
-        private void Form_ConstantsEditor_Click(object sender, EventArgs e)
-        {
-            groupBox_XmlTree_MaxEDSRules.Focus();
-        }
-        private void groupBox_Data_Click(object sender, EventArgs e)
-        {
-            groupBox_Data.Focus();
-        }
-        private void groupBox_ChemicalElement_Click(object sender, EventArgs e)
-        {
-            groupBox_ChemicalElement.Focus();
-        }
-        private void groupBox_OtherCommonlyUsedSymbols_Click(object sender, EventArgs e)
-        {
-            groupBox_OtherCommonlyUsedSymbols.Focus();
-        }
-        private void groupBox_CalculatingSymbols_Click(object sender, EventArgs e)
-        {
-            groupBox_CalculatingSymbols.Focus();
-        }
-        private void groupBox_XmlTree_MaxEDSRules_Click(object sender, EventArgs e)
-        {
-            groupBox_XmlTree_MaxEDSRules.Focus();
-        }
-        #endregion
-        private void button_1_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "1");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_2_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "2");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_3_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "3");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_4_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "4");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_5_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "5");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_6_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "6");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_7_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "7");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_8_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "8");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_9_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "9");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_0_Click(object sender, EventArgs e)
-        {
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "0");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-
-
-
-
-        //private float X = 1;
-        //private float Y = 1;
-        //float AmplificationFactor = 1;
-        private void Form_MaxEDSRules_Resize(object sender, EventArgs e)
-        {
-            //float newx = this.Width / X;
-            //float newy = this.Height / Y;
-            //AmplificationFactor = newy;
-            //setControls(newx, newy, this);
-            //this.Resize -= new System.EventHandler(this.Form_MaxEDSRules_Resize);
-
-            //if (panel_OTSPeriodicTable.Visible == false)
-            //{
-            //    int w = this.Width - panel_OTSPeriodicTable.Width;
-            //    this.Width = w;
-            //}
-
-            //this.Resize += new System.EventHandler(this.Form_MaxEDSRules_Resize);
-
-            ////if (WindowState == FormWindowState.Maximized)
-            ////{
-            ////    panel_OTSPeriodicTable.Visible = true;
-            ////    PeriodicTableSwitch.Enabled = false;
-            ////}
-        }
-        private void setTag(Control cons)
-        {
-            foreach (Control con in cons.Controls)
-            {
-                con.Tag = con.Width + ":" + con.Height + ":" + con.Left + ":" + con.Top + ":" + con.Font.Size;
-                if (con.Controls.Count > 0)
-                    setTag(con);
-            }
-        }
-
-        private void setControls(float newx, float newy, Control cons)
-        {
-            foreach (Control con in cons.Controls)
-            {
-                if (false)
-                {
-
-                }
-                else
-                {
-                    string[] mytag = con.Tag.ToString().Split(':');
-
-                    float a = Convert.ToSingle(mytag[0]) * newx;
-                    con.Width = (int)a;
-
-                    a = Convert.ToSingle(mytag[1]) * newy;
-                    con.Height = (int)(a);
-
-                    a = Convert.ToSingle(mytag[2]) * newx;
-                    con.Left = (int)(a);
-
-                    a = Convert.ToSingle(mytag[3]) * newy;
-                    con.Top = (int)(a);
-
-                    Single currentSize;
-
-                    if (con.GetType().ToString() == "System.Windows.Forms.Label")
-                    {
-                        currentSize = Convert.ToSingle(mytag[4]) * ((newx + newy) / 2);
-                        //currentSize = 6f;
-                    }
-                    else
-                    {
-                        if (Math.Max(newx, newy) < 1)
-                        {
-                            currentSize = Convert.ToSingle(mytag[4]) * 1;
-                        }
-                        else
-                        {
-                            currentSize = Convert.ToSingle(mytag[4]) * Math.Max(newx, newy);
-
-                        }
-                    }
-
-                    con.Font = new Font(con.Font.Name, currentSize, con.Font.Style, con.Font.Unit);
-                    if (con.Controls.Count > 0)
-                    {
-                        setControls(newx, newy, con);
-                    }
-
-                }
-            }
-        }
-
-        #region
-        //XmlDocument doc = new XmlDocument();
-        //doc.Load(Address);
-        //LoadXmlToTreeControl(doc,XmlTree_MaxEDSRules.Nodes);
-        //public string Language = "English";
-        //string Address_backup = Application.StartupPath + "\\Config\\SysData\\OTSParticleSTD_backup.xml";
-        //string Address = Application.StartupPath + "\\Config\\SysData\\OTSParticleSTD.xml";
-        //保存xmltree内容到xml文件
-        //void SaveXmlTreeDataToXml(string Address)
-        //{
-        //    XDocument xdoc = XDocument.Load(Address);
-        //    IEnumerable<XElement> elements = from ele in xdoc.Descendants("XMLData") select ele;
-
-        //    var item = (from ele1 in elements.Elements("Collection")
-        //                where ele1.Attribute("RegName").Value.Equals("MaxEDSRules")
-        //                select ele1).FirstOrDefault();
-        //    if (item != null)
-        //    {
-        //        item.Remove();
-        //    }
-
-        //    XElement MaxEDS = new XElement("Collection");
-        //    MaxEDS.SetAttributeValue("RegName", "MaxEDSRules");
-        //    elements.ElementAt(0).Add(MaxEDS);
-        //    for (int num = 0; num < XmlTree_MaxEDSRules.Nodes.Count; num++)
-        //    {
-        //        string UsingElementList = "";
-        //        string UsingImgPropertyList = "";
-        //        string UsingOtherPropertyList = "";
-        //        List<string> UsingElementL = new List<string>();
-        //        List<string> UsingImgPropertyL = new List<string>();
-        //        List<string> UsingOtherPropertyL = new List<string>();
-
-        //        string str_RemoveBlank = "";
-        //        //forth_elem干扰or分隔符,故先行去掉
-        //        if (XmlTree_MaxEDSRules.Nodes[num].Tag.ToString().Contains("forth_elem"))
-        //        {
-        //            str_RemoveBlank = str_RemoveBlank.Replace("forth_elem", "");
-        //            UsingOtherPropertyList = "forth_elem,";
-        //        }
-
-        //        str_RemoveBlank = XmlTree_MaxEDSRules.Nodes[num].Tag.ToString().Replace(" ", "");
-        //        string[] str_Removeand = System.Text.RegularExpressions.Regex.Split(str_RemoveBlank, "and", System.Text.RegularExpressions.RegexOptions.None);
-        //        List<string> str_Removeandor = new List<string>();
-        //        for (int i = 0; i < str_Removeand.Length; i++)
-        //        {
-        //            str_Removeandor.AddRange(System.Text.RegularExpressions.Regex.Split(str_Removeand[i], "or", System.Text.RegularExpressions.RegexOptions.None));
-        //        }
-        //        List<string> list_all = new List<string>();
-        //        for (int i = 0; i < str_Removeandor.Count; i++)
-        //        {
-        //            list_all.AddRange(str_Removeandor[i].Split(new char[] { '+', '-', '*', '/', '=', '>', '<', '(', ')' }));
-        //        }
-        //        for (int i = 0; i < list_all.Count; i++)
-        //        {
-        //            //周期元素?
-        //            if (this.comboBox_PeriodicTable.Items.Contains(list_all[i]))
-        //            {
-        //                if (!UsingElementL.Contains(list_all[i]))
-        //                {
-        //                    UsingElementL.Add(list_all[i]);
-        //                }
-        //            }
-        //            //first_elem?
-        //            if (this.comboBox_Elem1.Items.Contains(list_all[i]))
-        //            {
-        //                if (!UsingOtherPropertyL.Contains(list_all[i]))
-        //                {
-        //                    UsingOtherPropertyL.Add(list_all[i]);
-        //                }
-        //            }
-        //            //Element1?
-        //            if (this.comboBox_Elem.Items.Contains(list_all[i]))
-        //            {
-        //                if (!UsingOtherPropertyL.Contains(list_all[i]))
-        //                {
-        //                    UsingOtherPropertyL.Add(list_all[i]);
-        //                }
-        //            }
-        //            //其它元素?
-        //            if (this.comboBox_ImgProperty.Items.Contains(list_all[i]))
-        //            {
-        //                if (!UsingImgPropertyL.Contains(list_all[i]))
-        //                {
-        //                    UsingImgPropertyL.Add(list_all[i]);
-        //                }
-        //            }
-
-        //        }
-
-        //        if (UsingElementL.Count > 0)
-        //        {
-        //            for (int i = 0; i < UsingElementL.Count - 1; i++)
-        //            {
-        //                UsingElementList += UsingElementL[i] + ",";
-        //            }
-        //            UsingElementList += UsingElementL[UsingElementL.Count - 1];
-        //        }
-
-        //        if (UsingImgPropertyL.Count > 0)
-        //        {
-        //            for (int i = 0; i < UsingImgPropertyL.Count - 1; i++)
-        //            {
-        //                UsingImgPropertyList += UsingImgPropertyL[i] + ",";
-        //            }
-        //            UsingImgPropertyList += UsingImgPropertyL[UsingImgPropertyL.Count - 1];
-        //        }
-
-        //        if (UsingOtherPropertyL.Count > 0)
-        //        {
-        //            for (int i = 0; i < UsingOtherPropertyL.Count - 1; i++)
-        //            {
-        //                UsingOtherPropertyList += UsingOtherPropertyL[i] + ",";
-        //            }
-        //            UsingOtherPropertyList += UsingOtherPropertyL[UsingOtherPropertyL.Count - 1];
-        //        }
-
-        //        XElement EleName = new XElement("Member");
-        //        //EleName.SetAttributeValue("MaxEDSTime", XmlTree_MaxEDSRules.Nodes[num].Name);
-        //        EleName.SetAttributeValue("MaxEDSTime", textBox_MaxEDSTime.Text);
-        //        EleName.SetAttributeValue("UsingElementList", UsingElementList);
-        //        EleName.SetAttributeValue("UsingImgPropertyList", UsingImgPropertyList);
-        //        EleName.SetAttributeValue("UsingOtherPropertyList", UsingOtherPropertyList);
-        //        EleName.SetAttributeValue("Expression", XmlTree_MaxEDSRules.Nodes[num].Tag);
-
-        //        MaxEDS.Add(EleName);
-        //    }
-        //    xdoc.Save(Address);
-        //}
-        //private void button_Backup_Click(object sender, EventArgs e)
-        //{
-        //    if (XmlTree_MaxEDSRules.SelectedNode != null)
-        //    {
-        //        //判断MaxEDSTime
-        //        double dMaxEDSTime = 0;
-        //        if (!double.TryParse(textBox_MaxEDSTime.Text, out dMaxEDSTime) || double.Parse(textBox_MaxEDSTime.Text) <= 0)
-        //        {
-        //            textBox_MaxEDSTime.Focus();
-        //            textBox_MaxEDSTime.SelectAll();
-        //            MessageBox.Show(table["message16"].ToString(), table["message32"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
-        //            return;
-        //        }
-        //        //判断textbox_STDEditor
-        //        if (!Checktextbox_STDEditor())
-        //        {
-        //            return;
-        //        }
-        //        XmlTree_MaxEDSRules.SelectedNode.Tag = this.textbox_STDEditor.Text;
-        //        //XmlTree_MaxEDSRules.SelectedNode.Name = textBox_MaxEDSTime.Text;
-        //    }
-
-        //    try
-        //    {
-        //        SaveFileDialog saveFile = new SaveFileDialog();
-        //        saveFile.Title = table["message23"].ToString();
-        //        saveFile.Filter = table["message24"].ToString();
-        //        saveFile.OverwritePrompt = true;  //是否覆盖当前文件
-        //        saveFile.RestoreDirectory = true;  //还原上次目录
-        //        if (saveFile.ShowDialog() == DialogResult.OK)
-        //        {
-
-        //            System.IO.File.Copy(Address, saveFile.FileName, true);
-        //            SaveXmlTreeDataToXml(saveFile.FileName);
-        //            MessageBox.Show(table["message25"].ToString(), table["message32"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
-        //        }
-        //        else
-        //        {
-        //            return;
-        //        }
-        //    }
-        //    catch (Exception ex)
-        //    {
-        //        MessageBox.Show(ex.Message);
-        //    }
-
-        //}
-        #endregion
-
-        private void Form_MaxEDSRules_FormClosing(object sender, FormClosingEventArgs e)
-        {
-            if (form_PeriodicTable != null)
-            {
-                form_PeriodicTable.Close();
-            }
-        }
-    }
-}

+ 0 - 353
OTSPartA_STDEditor/UI/Form_UserConstants.Designer.cs

@@ -1,353 +0,0 @@
-namespace OTSPartA_STDEditor
-{
-    partial class Form_UserConstants
-    {
-        /// <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.groupBox1 = new System.Windows.Forms.GroupBox();
-            this.button_UpdateConstants = new System.Windows.Forms.Button();
-            this.label_ConstantValue = new System.Windows.Forms.Label();
-            this.checkBox_3 = new System.Windows.Forms.CheckBox();
-            this.label_ConstantSymbol = new System.Windows.Forms.Label();
-            this.checkBox_0 = new System.Windows.Forms.CheckBox();
-            this.textBox_9 = new System.Windows.Forms.TextBox();
-            this.textBox_0 = new System.Windows.Forms.TextBox();
-            this.checkBox_9 = new System.Windows.Forms.CheckBox();
-            this.checkBox_1 = new System.Windows.Forms.CheckBox();
-            this.textBox_8 = new System.Windows.Forms.TextBox();
-            this.textBox_1 = new System.Windows.Forms.TextBox();
-            this.checkBox_8 = new System.Windows.Forms.CheckBox();
-            this.checkBox_2 = new System.Windows.Forms.CheckBox();
-            this.textBox_7 = new System.Windows.Forms.TextBox();
-            this.textBox_2 = new System.Windows.Forms.TextBox();
-            this.checkBox_7 = new System.Windows.Forms.CheckBox();
-            this.textBox_3 = new System.Windows.Forms.TextBox();
-            this.textBox_6 = new System.Windows.Forms.TextBox();
-            this.checkBox_4 = new System.Windows.Forms.CheckBox();
-            this.checkBox_6 = new System.Windows.Forms.CheckBox();
-            this.textBox_4 = new System.Windows.Forms.TextBox();
-            this.textBox_5 = new System.Windows.Forms.TextBox();
-            this.checkBox_5 = new System.Windows.Forms.CheckBox();
-            this.groupBox1.SuspendLayout();
-            this.SuspendLayout();
-            // 
-            // groupBox1
-            // 
-            this.groupBox1.Controls.Add(this.button_UpdateConstants);
-            this.groupBox1.Controls.Add(this.label_ConstantValue);
-            this.groupBox1.Controls.Add(this.checkBox_3);
-            this.groupBox1.Controls.Add(this.label_ConstantSymbol);
-            this.groupBox1.Controls.Add(this.checkBox_0);
-            this.groupBox1.Controls.Add(this.textBox_9);
-            this.groupBox1.Controls.Add(this.textBox_0);
-            this.groupBox1.Controls.Add(this.checkBox_9);
-            this.groupBox1.Controls.Add(this.checkBox_1);
-            this.groupBox1.Controls.Add(this.textBox_8);
-            this.groupBox1.Controls.Add(this.textBox_1);
-            this.groupBox1.Controls.Add(this.checkBox_8);
-            this.groupBox1.Controls.Add(this.checkBox_2);
-            this.groupBox1.Controls.Add(this.textBox_7);
-            this.groupBox1.Controls.Add(this.textBox_2);
-            this.groupBox1.Controls.Add(this.checkBox_7);
-            this.groupBox1.Controls.Add(this.textBox_3);
-            this.groupBox1.Controls.Add(this.textBox_6);
-            this.groupBox1.Controls.Add(this.checkBox_4);
-            this.groupBox1.Controls.Add(this.checkBox_6);
-            this.groupBox1.Controls.Add(this.textBox_4);
-            this.groupBox1.Controls.Add(this.textBox_5);
-            this.groupBox1.Controls.Add(this.checkBox_5);
-            this.groupBox1.Location = new System.Drawing.Point(13, 4);
-            this.groupBox1.Name = "groupBox1";
-            this.groupBox1.Size = new System.Drawing.Size(238, 633);
-            this.groupBox1.TabIndex = 0;
-            this.groupBox1.TabStop = false;
-            // 
-            // button_UpdateConstants
-            // 
-            this.button_UpdateConstants.Location = new System.Drawing.Point(23, 572);
-            this.button_UpdateConstants.Name = "button_UpdateConstants";
-            this.button_UpdateConstants.Size = new System.Drawing.Size(196, 35);
-            this.button_UpdateConstants.TabIndex = 47;
-            this.button_UpdateConstants.Text = "确认更新常数库";
-            this.button_UpdateConstants.UseVisualStyleBackColor = true;
-            this.button_UpdateConstants.Click += new System.EventHandler(this.button_UpdateConstants_Click);
-            // 
-            // label_ConstantValue
-            // 
-            this.label_ConstantValue.AutoSize = true;
-            this.label_ConstantValue.Location = new System.Drawing.Point(157, 32);
-            this.label_ConstantValue.Name = "label_ConstantValue";
-            this.label_ConstantValue.Size = new System.Drawing.Size(17, 12);
-            this.label_ConstantValue.TabIndex = 46;
-            this.label_ConstantValue.Text = "值";
-            // 
-            // checkBox_3
-            // 
-            this.checkBox_3.AutoSize = true;
-            this.checkBox_3.Location = new System.Drawing.Point(23, 211);
-            this.checkBox_3.Name = "checkBox_3";
-            this.checkBox_3.Size = new System.Drawing.Size(54, 16);
-            this.checkBox_3.TabIndex = 31;
-            this.checkBox_3.Text = "MAC#3";
-            this.checkBox_3.UseVisualStyleBackColor = true;
-            this.checkBox_3.CheckedChanged += new System.EventHandler(this.checkBox_3_CheckedChanged);
-            // 
-            // label_ConstantSymbol
-            // 
-            this.label_ConstantSymbol.AutoSize = true;
-            this.label_ConstantSymbol.Location = new System.Drawing.Point(24, 32);
-            this.label_ConstantSymbol.Name = "label_ConstantSymbol";
-            this.label_ConstantSymbol.Size = new System.Drawing.Size(53, 12);
-            this.label_ConstantSymbol.TabIndex = 45;
-            this.label_ConstantSymbol.Text = "常量符号";
-            // 
-            // checkBox_0
-            // 
-            this.checkBox_0.AutoSize = true;
-            this.checkBox_0.Location = new System.Drawing.Point(23, 72);
-            this.checkBox_0.Name = "checkBox_0";
-            this.checkBox_0.Size = new System.Drawing.Size(54, 16);
-            this.checkBox_0.TabIndex = 25;
-            this.checkBox_0.Tag = "";
-            this.checkBox_0.Text = "MAC#0";
-            this.checkBox_0.UseVisualStyleBackColor = true;
-            this.checkBox_0.CheckedChanged += new System.EventHandler(this.checkBox_0_CheckedChanged);
-            // 
-            // textBox_9
-            // 
-            this.textBox_9.Location = new System.Drawing.Point(117, 501);
-            this.textBox_9.Name = "textBox_9";
-            this.textBox_9.Size = new System.Drawing.Size(102, 21);
-            this.textBox_9.TabIndex = 44;
-            this.textBox_9.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
-            // textBox_0
-            // 
-            this.textBox_0.Location = new System.Drawing.Point(117, 71);
-            this.textBox_0.Name = "textBox_0";
-            this.textBox_0.Size = new System.Drawing.Size(102, 21);
-            this.textBox_0.TabIndex = 26;
-            this.textBox_0.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
-            // checkBox_9
-            // 
-            this.checkBox_9.AutoSize = true;
-            this.checkBox_9.Location = new System.Drawing.Point(23, 503);
-            this.checkBox_9.Name = "checkBox_9";
-            this.checkBox_9.Size = new System.Drawing.Size(54, 16);
-            this.checkBox_9.TabIndex = 43;
-            this.checkBox_9.Text = "MAC#9";
-            this.checkBox_9.UseVisualStyleBackColor = true;
-            this.checkBox_9.CheckedChanged += new System.EventHandler(this.checkBox_9_CheckedChanged);
-            // 
-            // checkBox_1
-            // 
-            this.checkBox_1.AutoSize = true;
-            this.checkBox_1.Location = new System.Drawing.Point(23, 119);
-            this.checkBox_1.Name = "checkBox_1";
-            this.checkBox_1.Size = new System.Drawing.Size(54, 16);
-            this.checkBox_1.TabIndex = 27;
-            this.checkBox_1.Text = "MAC#1";
-            this.checkBox_1.UseVisualStyleBackColor = true;
-            this.checkBox_1.CheckedChanged += new System.EventHandler(this.checkBox_1_CheckedChanged);
-            // 
-            // textBox_8
-            // 
-            this.textBox_8.Location = new System.Drawing.Point(117, 449);
-            this.textBox_8.Name = "textBox_8";
-            this.textBox_8.Size = new System.Drawing.Size(102, 21);
-            this.textBox_8.TabIndex = 42;
-            this.textBox_8.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
-            // textBox_1
-            // 
-            this.textBox_1.Location = new System.Drawing.Point(117, 117);
-            this.textBox_1.Name = "textBox_1";
-            this.textBox_1.Size = new System.Drawing.Size(102, 21);
-            this.textBox_1.TabIndex = 28;
-            this.textBox_1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
-            // checkBox_8
-            // 
-            this.checkBox_8.AutoSize = true;
-            this.checkBox_8.Location = new System.Drawing.Point(23, 451);
-            this.checkBox_8.Name = "checkBox_8";
-            this.checkBox_8.Size = new System.Drawing.Size(54, 16);
-            this.checkBox_8.TabIndex = 41;
-            this.checkBox_8.Text = "MAC#8";
-            this.checkBox_8.UseVisualStyleBackColor = true;
-            this.checkBox_8.CheckedChanged += new System.EventHandler(this.checkBox_8_CheckedChanged);
-            // 
-            // checkBox_2
-            // 
-            this.checkBox_2.AutoSize = true;
-            this.checkBox_2.Location = new System.Drawing.Point(23, 161);
-            this.checkBox_2.Name = "checkBox_2";
-            this.checkBox_2.Size = new System.Drawing.Size(54, 16);
-            this.checkBox_2.TabIndex = 29;
-            this.checkBox_2.Text = "MAC#2";
-            this.checkBox_2.UseVisualStyleBackColor = true;
-            this.checkBox_2.CheckedChanged += new System.EventHandler(this.checkBox_2_CheckedChanged);
-            // 
-            // textBox_7
-            // 
-            this.textBox_7.Location = new System.Drawing.Point(117, 400);
-            this.textBox_7.Name = "textBox_7";
-            this.textBox_7.Size = new System.Drawing.Size(102, 21);
-            this.textBox_7.TabIndex = 40;
-            this.textBox_7.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
-            // textBox_2
-            // 
-            this.textBox_2.Location = new System.Drawing.Point(117, 160);
-            this.textBox_2.Name = "textBox_2";
-            this.textBox_2.Size = new System.Drawing.Size(102, 21);
-            this.textBox_2.TabIndex = 30;
-            this.textBox_2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
-            // checkBox_7
-            // 
-            this.checkBox_7.AutoSize = true;
-            this.checkBox_7.Location = new System.Drawing.Point(23, 402);
-            this.checkBox_7.Name = "checkBox_7";
-            this.checkBox_7.Size = new System.Drawing.Size(54, 16);
-            this.checkBox_7.TabIndex = 39;
-            this.checkBox_7.Text = "MAC#7";
-            this.checkBox_7.UseVisualStyleBackColor = true;
-            this.checkBox_7.CheckedChanged += new System.EventHandler(this.checkBox_7_CheckedChanged);
-            // 
-            // textBox_3
-            // 
-            this.textBox_3.Location = new System.Drawing.Point(117, 209);
-            this.textBox_3.Name = "textBox_3";
-            this.textBox_3.Size = new System.Drawing.Size(102, 21);
-            this.textBox_3.TabIndex = 32;
-            this.textBox_3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
-            // textBox_6
-            // 
-            this.textBox_6.Location = new System.Drawing.Point(117, 349);
-            this.textBox_6.Name = "textBox_6";
-            this.textBox_6.Size = new System.Drawing.Size(102, 21);
-            this.textBox_6.TabIndex = 38;
-            this.textBox_6.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
-            // checkBox_4
-            // 
-            this.checkBox_4.AutoSize = true;
-            this.checkBox_4.Location = new System.Drawing.Point(23, 255);
-            this.checkBox_4.Name = "checkBox_4";
-            this.checkBox_4.Size = new System.Drawing.Size(54, 16);
-            this.checkBox_4.TabIndex = 33;
-            this.checkBox_4.Text = "MAC#4";
-            this.checkBox_4.UseVisualStyleBackColor = true;
-            this.checkBox_4.CheckedChanged += new System.EventHandler(this.checkBox_4_CheckedChanged);
-            // 
-            // checkBox_6
-            // 
-            this.checkBox_6.AutoSize = true;
-            this.checkBox_6.Location = new System.Drawing.Point(23, 352);
-            this.checkBox_6.Name = "checkBox_6";
-            this.checkBox_6.Size = new System.Drawing.Size(54, 16);
-            this.checkBox_6.TabIndex = 37;
-            this.checkBox_6.Text = "MAC#6";
-            this.checkBox_6.UseVisualStyleBackColor = true;
-            this.checkBox_6.CheckedChanged += new System.EventHandler(this.checkBox_6_CheckedChanged);
-            // 
-            // textBox_4
-            // 
-            this.textBox_4.Location = new System.Drawing.Point(117, 253);
-            this.textBox_4.Name = "textBox_4";
-            this.textBox_4.Size = new System.Drawing.Size(102, 21);
-            this.textBox_4.TabIndex = 34;
-            this.textBox_4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
-            // textBox_5
-            // 
-            this.textBox_5.Location = new System.Drawing.Point(117, 302);
-            this.textBox_5.Name = "textBox_5";
-            this.textBox_5.Size = new System.Drawing.Size(102, 21);
-            this.textBox_5.TabIndex = 36;
-            this.textBox_5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
-            // 
-            // checkBox_5
-            // 
-            this.checkBox_5.AutoSize = true;
-            this.checkBox_5.Location = new System.Drawing.Point(23, 303);
-            this.checkBox_5.Name = "checkBox_5";
-            this.checkBox_5.Size = new System.Drawing.Size(54, 16);
-            this.checkBox_5.TabIndex = 35;
-            this.checkBox_5.Text = "MAC#5";
-            this.checkBox_5.UseVisualStyleBackColor = true;
-            this.checkBox_5.CheckedChanged += new System.EventHandler(this.checkBox_5_CheckedChanged);
-            // 
-            // Form_UserConstants
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(263, 650);
-            this.Controls.Add(this.groupBox1);
-            this.MaximizeBox = false;
-            this.Name = "Form_UserConstants";
-            this.ShowIcon = false;
-            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
-            this.Text = "Form_UserConstants";
-            this.Load += new System.EventHandler(this.Form_UserConstants_Load);
-            this.groupBox1.ResumeLayout(false);
-            this.groupBox1.PerformLayout();
-            this.ResumeLayout(false);
-
-        }
-
-        #endregion
-
-        private System.Windows.Forms.GroupBox groupBox1;
-        private System.Windows.Forms.Button button_UpdateConstants;
-        private System.Windows.Forms.Label label_ConstantValue;
-        private System.Windows.Forms.CheckBox checkBox_3;
-        private System.Windows.Forms.Label label_ConstantSymbol;
-        private System.Windows.Forms.CheckBox checkBox_0;
-        private System.Windows.Forms.TextBox textBox_9;
-        private System.Windows.Forms.TextBox textBox_0;
-        private System.Windows.Forms.CheckBox checkBox_9;
-        private System.Windows.Forms.CheckBox checkBox_1;
-        private System.Windows.Forms.TextBox textBox_8;
-        private System.Windows.Forms.TextBox textBox_1;
-        private System.Windows.Forms.CheckBox checkBox_8;
-        private System.Windows.Forms.CheckBox checkBox_2;
-        private System.Windows.Forms.TextBox textBox_7;
-        private System.Windows.Forms.TextBox textBox_2;
-        private System.Windows.Forms.CheckBox checkBox_7;
-        private System.Windows.Forms.TextBox textBox_3;
-        private System.Windows.Forms.TextBox textBox_6;
-        private System.Windows.Forms.CheckBox checkBox_4;
-        private System.Windows.Forms.CheckBox checkBox_6;
-        private System.Windows.Forms.TextBox textBox_4;
-        private System.Windows.Forms.TextBox textBox_5;
-        private System.Windows.Forms.CheckBox checkBox_5;
-    }
-}

+ 0 - 544
OTSPartA_STDEditor/UI/Form_UserConstants.cs

@@ -1,544 +0,0 @@
-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.Windows.Forms;
-using System.Xml;
-using System.Xml.Linq;
-
-namespace OTSPartA_STDEditor
-{
-    public partial class Form_UserConstants : Form
-    {
-        //国际化
-        Language lan;
-        System.Collections.Hashtable table;
-        string STDDBAddress = Application.StartupPath + "\\Config\\SysData\\" + "OTSCleanlinesSTD.db";
-
-        public Form_UserConstants(string DBAddress)
-        {
-            InitializeComponent();
-            STDDBAddress = DBAddress;
-        }
-
-        private void Form_UserConstants_Load(object sender, EventArgs e)
-        {
-            checkBox_0.Checked = false;
-            checkBox_1.Checked = false;
-            checkBox_2.Checked = false;
-            checkBox_3.Checked = false;
-            checkBox_4.Checked = false;
-            checkBox_5.Checked = false;
-            checkBox_6.Checked = false;
-            checkBox_7.Checked = false;
-            checkBox_8.Checked = false;
-            checkBox_9.Checked = false;
-            textBox_0.ReadOnly = true;
-            textBox_1.ReadOnly = true;
-            textBox_2.ReadOnly = true;
-            textBox_3.ReadOnly = true;
-            textBox_4.ReadOnly = true;
-            textBox_5.ReadOnly = true;
-            textBox_6.ReadOnly = true;
-            textBox_7.ReadOnly = true;
-            textBox_8.ReadOnly = true;
-            textBox_9.ReadOnly = true;
-
-            lan = new Language(this);
-            table = lan.GetNameTable("Form_UserConstants");
-
-            LoadXmlConstantsTreeControl(STDDBAddress);
-
-            this.DialogResult = DialogResult.None;
-        }
-
-        void LoadXmlConstantsTreeControl(string STDDBAddress)
-        {
-            try
-            {
-                System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + STDDBAddress + "'");
-                m_dbConnection.Open();
-                System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from Constants", m_dbConnection);
-                DataSet ds = new DataSet();
-                m_dataAdapter.Fill(ds);
-                DataTable dt = ds.Tables[0];
-                string ConstantsStr = "";
-                if (dt.Rows.Count >0)
-                {
-                    ConstantsStr = dt.Rows[0][0].ToString();
-                }
-                m_dbConnection.Close();
-                ConstantsStr = ConstantsStr.Replace(" ", "");
-                string[] ConstantsStr2 = ConstantsStr.Split(',');
-
-                List<string> comboBox_Constants = new List<string>();
-                comboBox_Constants.AddRange(ConstantsStr2);
-
-                List<string> Constantslist = new List<string>();
-                for (int i = 0; i < ConstantsStr2.Length; i++)
-                {
-                    Constantslist.AddRange(ConstantsStr2[i].Split('='));
-                }
-                for (int i = 0; i < Constantslist.Count; i += 2)
-                {
-                    if (Constantslist[i].Contains("MAC#0"))
-                    {
-                        this.checkBox_0.Checked = true;
-                        this.textBox_0.ReadOnly = false;
-                        this.textBox_0.Text = Constantslist[i + 1];
-                    }
-                    else if (Constantslist[i].Contains("MAC#1"))
-                    {
-                        this.checkBox_1.Checked = true;
-                        this.textBox_1.ReadOnly = false;
-                        this.textBox_1.Text = Constantslist[i + 1];
-                    }
-                    else if (Constantslist[i].Contains("MAC#2"))
-                    {
-                        this.checkBox_2.Checked = true;
-                        this.textBox_2.ReadOnly = false;
-                        this.textBox_2.Text = Constantslist[i + 1];
-                    }
-                    else if (Constantslist[i].Contains("MAC#3"))
-                    {
-                        this.checkBox_3.Checked = true;
-                        this.textBox_3.ReadOnly = false;
-                        this.textBox_3.Text = Constantslist[i + 1];
-                    }
-                    else if (Constantslist[i].Contains("MAC#4"))
-                    {
-                        this.checkBox_4.Checked = true;
-                        this.textBox_4.ReadOnly = false;
-                        this.textBox_4.Text = Constantslist[i + 1];
-                    }
-                    else if (Constantslist[i].Contains("MAC#5"))
-                    {
-                        this.checkBox_5.Checked = true;
-                        this.textBox_5.ReadOnly = false;
-                        this.textBox_5.Text = Constantslist[i + 1];
-                    }
-                    else if (Constantslist[i].Contains("MAC#6"))
-                    {
-                        this.checkBox_6.Checked = true;
-                        this.textBox_6.ReadOnly = false;
-                        this.textBox_6.Text = Constantslist[i + 1];
-                    }
-                    else if (Constantslist[i].Contains("MAC#7"))
-                    {
-                        this.checkBox_7.Checked = true;
-                        this.textBox_7.ReadOnly = false;
-                        this.textBox_7.Text = Constantslist[i + 1];
-                    }
-                    else if (Constantslist[i].Contains("MAC#8"))
-                    {
-                        this.checkBox_8.Checked = true;
-                        this.textBox_8.ReadOnly = false;
-                        this.textBox_8.Text = Constantslist[i + 1];
-                    }
-                    else if (Constantslist[i].Contains("MAC#9"))
-                    {
-                        this.checkBox_9.Checked = true;
-                        this.textBox_9.ReadOnly = false;
-                        this.textBox_9.Text = Constantslist[i + 1];
-                    }
-                }
-            }
-            catch (Exception ee)
-            {
-                MessageBox.Show(ee.ToString());
-            }
-        }
-
-        private void button_UpdateConstants_Click(object sender, EventArgs e)
-        {
-            List<string> Constantslist = new List<string>();
-
-            for (int i = 0; i < 10; i++)
-            {
-                CheckBox checkBox = (CheckBox)this.groupBox1.Controls.Find("checkBox_" + i.ToString(), false)[0];
-                if (checkBox.Checked)
-                {
-                    TextBox tBox = (TextBox)this.groupBox1.Controls.Find("textBox_" + i.ToString(), false)[0];
-                    double DoubleTry = 0;
-                    if (double.TryParse(tBox.Text, out DoubleTry))
-                    {
-                        Constantslist.Add(checkBox.Text + "=" + tBox.Text);
-                    }
-                    else
-                    {
-                        MessageBox.Show("Symbol" + checkBox.Name + "Input error for corresponding value!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Warning);
-                        return;
-                    }
-                }
-            }
-
-            string value = "";
-            foreach (var str in Constantslist)
-            {
-                value += str + ",";
-            }
-            if (value != "")
-            {
-                value = value.Substring(0, value.Length - 1);
-            }
-
-            System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + STDDBAddress + "'");
-            System.Data.SQLite.SQLiteCommand cmm = m_dbConnection.CreateCommand();
-            cmm.CommandText = "delete from Constants";
-            try
-            {
-                m_dbConnection.Open();
-                cmm.ExecuteNonQuery();
-
-                string insertstr = "Insert into Constants(value)";
-                string aa = "values("+"'" + value + "'"+")";
-                cmm.CommandText = insertstr + aa;
-                cmm.ExecuteNonQuery();
-                m_dbConnection.Close();
-            }
-            catch (Exception ex)
-            {
-                MessageBox.Show(ex.ToString());
-            }
-            
-
-            MessageBox.Show("The library of constants updated successfully!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-
-            this.DialogResult = DialogResult.Yes;
-        }
-
-
-        private bool CheckConstantIsUseingInDB(string ConstantSysbol,string dbName)
-        {
-            try
-            {
-                System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + STDDBAddress + "'");
-                m_dbConnection.Open();
-                System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select Expression from "+ dbName, m_dbConnection); //,MaxEDSRules,ZeroElementRules
-                DataSet ds = new DataSet();
-                m_dataAdapter.Fill(ds);
-                DataTable dt = ds.Tables[0];
-
-                if (dt != null)
-                {
-                    if (dt.Rows.Count > 0)
-                    {
-                        foreach (DataRow item in dt.Rows)
-                        {
-                            if (item["Expression"].ToString().Contains(ConstantSysbol))
-                            {
-                                return false;
-                            }
-                        }
-                    }
-                }
-
-                return true;
-            }
-            catch (Exception ee)
-            {
-                MessageBox.Show(ee.ToString());
-                return false;
-            }
-        }
-
-
-        private bool CheckConstantIsUseing(string ConstantSysbol)
-        {
-            if (CheckConstantIsUseingInDB(ConstantSysbol, "ClassifySTD") && CheckConstantIsUseingInDB(ConstantSysbol, "MaxEDSRules") && CheckConstantIsUseingInDB(ConstantSysbol, "ZeroElementRules"))
-            {
-                return true;
-            }
-            else
-            {
-                MessageBox.Show("Failed to close. Applied to other rules!", "Tip");
-                return false;
-            }
-        }
-
-        private void checkBox_0_CheckedChanged(object sender, EventArgs e)
-        {
-            if (checkBox_0.Checked)
-            {
-                textBox_0.ReadOnly = false;
-            }
-            else
-            {
-                if (!CheckConstantIsUseing(checkBox_0.Text))
-                {
-                    checkBox_0.Checked = true;
-                }
-                else
-                {
-                    textBox_0.ReadOnly = true;
-                }
-            }
-        }
-
-        private void checkBox_1_CheckedChanged(object sender, EventArgs e)
-        {
-            if (checkBox_1.Checked)
-            {
-                textBox_1.ReadOnly = false;
-            }
-            else
-            {
-                if (!CheckConstantIsUseing(checkBox_1.Text))
-                {
-                    checkBox_1.Checked = true;
-                }
-                else
-                {
-                    textBox_1.ReadOnly = true;
-                }
-            }
-        }
-
-        private void checkBox_2_CheckedChanged(object sender, EventArgs e)
-        {
-            if (checkBox_2.Checked)
-            {
-                textBox_2.ReadOnly = false;
-            }
-            else
-            {
-                if (!CheckConstantIsUseing(checkBox_2.Text))
-                {
-                    checkBox_2.Checked = true;
-                }
-                else
-                {
-                    textBox_2.ReadOnly = true;
-                }
-            }
-        }
-
-        private void checkBox_3_CheckedChanged(object sender, EventArgs e)
-        {
-            if (checkBox_3.Checked)
-            {
-                textBox_3.ReadOnly = false;
-            }
-            else
-            {
-                if (!CheckConstantIsUseing(checkBox_3.Text))
-                {
-                    checkBox_3.Checked = true;
-                }
-                else
-                {
-                    textBox_3.ReadOnly = true;
-                }
-            }
-        }
-
-        private void checkBox_4_CheckedChanged(object sender, EventArgs e)
-        {
-            if (checkBox_4.Checked)
-            {
-                textBox_4.ReadOnly = false;
-            }
-            else
-            {
-                if (!CheckConstantIsUseing(checkBox_4.Text))
-                {
-                    checkBox_4.Checked = true;
-                }
-                else
-                {
-                    textBox_4.ReadOnly = true;
-                }
-            }
-        }
-
-        private void checkBox_5_CheckedChanged(object sender, EventArgs e)
-        {
-            if (checkBox_5.Checked)
-            {
-                textBox_5.ReadOnly = false;
-            }
-            else
-            {
-                if (!CheckConstantIsUseing(checkBox_5.Text))
-                {
-                    checkBox_5.Checked = true;
-                }
-                else
-                {
-                    textBox_5.ReadOnly = true;
-                }
-            }
-        }
-
-        private void checkBox_6_CheckedChanged(object sender, EventArgs e)
-        {
-            if (checkBox_6.Checked)
-            {
-                textBox_6.ReadOnly = false;
-            }
-            else
-            {
-                if (!CheckConstantIsUseing(checkBox_6.Text))
-                {
-                    checkBox_6.Checked = true;
-                }
-                else
-                {
-                    textBox_6.ReadOnly = true;
-                }
-            }
-        }
-
-        private void checkBox_7_CheckedChanged(object sender, EventArgs e)
-        {
-            if (checkBox_7.Checked)
-            {
-                textBox_7.ReadOnly = false;
-            }
-            else
-            {
-                if (!CheckConstantIsUseing(checkBox_7.Text))
-                {
-                    checkBox_7.Checked = true;
-                }
-                else
-                {
-                    textBox_7.ReadOnly = true;
-                }
-            }
-        }
-
-        private void checkBox_8_CheckedChanged(object sender, EventArgs e)
-        {
-            if (checkBox_8.Checked)
-            {
-                textBox_8.ReadOnly = false;
-            }
-            else
-            {
-                if (!CheckConstantIsUseing(checkBox_8.Text))
-                {
-                    checkBox_8.Checked = true;
-                }
-                else
-                {
-                    textBox_8.ReadOnly = true;
-                }
-            }
-        }
-
-        private void checkBox_9_CheckedChanged(object sender, EventArgs e)
-        {
-            if (checkBox_9.Checked)
-            {
-                textBox_9.ReadOnly = false;
-            }
-            else
-            {
-                if (!CheckConstantIsUseing(checkBox_9.Text))
-                {
-                    checkBox_9.Checked = true;
-                }
-                else
-                {
-                    textBox_9.ReadOnly = true;
-                }
-            }
-        }
-        #region
-        //string Address_backup = Application.StartupPath + "\\Config\\SysData\\OTSParticleSTD_backup.xml";
-        //string Address = Application.StartupPath + "\\Config\\SysData\\OTSParticleSTD.xml";
-        //XmlDocument doc = new XmlDocument();
-        //doc.Load(Address);
-        //LoadXmlToTreeControl(doc);
-        //void LoadXmlToTreeControl(XmlDocument xml)
-        //{
-        //    XmlNode root = xml.SelectSingleNode("XMLData");
-        //    XmlNodeList root2 = root.SelectNodes("Collection");
-
-        //    XmlNode root3 = root.SelectSingleNode("Member");
-        //    string ConstantsStr = root3.Attributes["value"].Value;
-        //    ConstantsStr = ConstantsStr.Replace(" ", "");
-        //    string[] ConstantsStr2 = ConstantsStr.Split(',');
-
-        //    List<string> comboBox_Constants = new List<string>();
-        //    comboBox_Constants.AddRange(ConstantsStr2);
-
-        //    List<string> Constantslist = new List<string>();
-        //    for (int i = 0; i < ConstantsStr2.Length; i++)
-        //    {
-        //        Constantslist.AddRange(ConstantsStr2[i].Split('='));
-        //    }
-        //    for (int i = 0; i < Constantslist.Count; i += 2)
-        //    {
-        //        if (Constantslist[i].Contains("MAC#0"))
-        //        {
-        //            this.checkBox_0.Checked = true;
-        //            this.textBox_0.ReadOnly = false;
-        //            this.textBox_0.Text = Constantslist[i + 1];
-        //        }
-        //        else if (Constantslist[i].Contains("MAC#1"))
-        //        {
-        //            this.checkBox_1.Checked = true;
-        //            this.textBox_1.ReadOnly = false;
-        //            this.textBox_1.Text = Constantslist[i + 1];
-        //        }
-        //        else if (Constantslist[i].Contains("MAC#2"))
-        //        {
-        //            this.checkBox_2.Checked = true;
-        //            this.textBox_2.ReadOnly = false;
-        //            this.textBox_2.Text = Constantslist[i + 1];
-        //        }
-        //        else if (Constantslist[i].Contains("MAC#3"))
-        //        {
-        //            this.checkBox_3.Checked = true;
-        //            this.textBox_3.ReadOnly = false;
-        //            this.textBox_3.Text = Constantslist[i + 1];
-        //        }
-        //        else if (Constantslist[i].Contains("MAC#4"))
-        //        {
-        //            this.checkBox_4.Checked = true;
-        //            this.textBox_4.ReadOnly = false;
-        //            this.textBox_4.Text = Constantslist[i + 1];
-        //        }
-        //        else if (Constantslist[i].Contains("MAC#5"))
-        //        {
-        //            this.checkBox_5.Checked = true;
-        //            this.textBox_5.ReadOnly = false;
-        //            this.textBox_5.Text = Constantslist[i + 1];
-        //        }
-        //        else if (Constantslist[i].Contains("MAC#6"))
-        //        {
-        //            this.checkBox_6.Checked = true;
-        //            this.textBox_6.ReadOnly = false;
-        //            this.textBox_6.Text = Constantslist[i + 1];
-        //        }
-        //        else if (Constantslist[i].Contains("MAC#7"))
-        //        {
-        //            this.checkBox_7.Checked = true;
-        //            this.textBox_7.ReadOnly = false;
-        //            this.textBox_7.Text = Constantslist[i + 1];
-        //        }
-        //        else if (Constantslist[i].Contains("MAC#8"))
-        //        {
-        //            this.checkBox_8.Checked = true;
-        //            this.textBox_8.ReadOnly = false;
-        //            this.textBox_8.Text = Constantslist[i + 1];
-        //        }
-        //        else if (Constantslist[i].Contains("MAC#9"))
-        //        {
-        //            this.checkBox_9.Checked = true;
-        //            this.textBox_9.ReadOnly = false;
-        //            this.textBox_9.Text = Constantslist[i + 1];
-        //        }
-        //    }
-        //}
-        #endregion
-    }
-}
-
-

+ 0 - 655
OTSPartA_STDEditor/UI/Form_ZeroElementRules.Designer.cs

@@ -1,655 +0,0 @@
-namespace OTSPartA_STDEditor
-{
-    partial class Form_ZeroElementRules
-    {
-        /// <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.components = new System.ComponentModel.Container();
-            this.XmlTree_ZeroElementRules = new System.Windows.Forms.TreeView();
-            this.XmlTreeMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
-            this.新建标准库规则ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.删除ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.button_Cancel = new System.Windows.Forms.Button();
-            this.PeriodicTableSwitch = new System.Windows.Forms.Button();
-            this.textbox_STDEditor = new System.Windows.Forms.TextBox();
-            this.button_Ok = new System.Windows.Forms.Button();
-            this.button_0 = new System.Windows.Forms.Button();
-            this.button_9 = new System.Windows.Forms.Button();
-            this.button_4 = new System.Windows.Forms.Button();
-            this.button_5 = new System.Windows.Forms.Button();
-            this.button_6 = new System.Windows.Forms.Button();
-            this.button_7 = new System.Windows.Forms.Button();
-            this.button_8 = new System.Windows.Forms.Button();
-            this.button_Divide = new System.Windows.Forms.Button();
-            this.button_Or = new System.Windows.Forms.Button();
-            this.button_And = new System.Windows.Forms.Button();
-            this.button_3 = new System.Windows.Forms.Button();
-            this.button_2 = new System.Windows.Forms.Button();
-            this.button_1 = new System.Windows.Forms.Button();
-            this.button_Equal = new System.Windows.Forms.Button();
-            this.button_RightParenthesis = new System.Windows.Forms.Button();
-            this.button_LeftParenthesis = new System.Windows.Forms.Button();
-            this.button_Less = new System.Windows.Forms.Button();
-            this.button_More = new System.Windows.Forms.Button();
-            this.button_Multiply = new System.Windows.Forms.Button();
-            this.groupBox_CalculatingSymbols = new System.Windows.Forms.GroupBox();
-            this.button_Subtract = new System.Windows.Forms.Button();
-            this.button_Plus = new System.Windows.Forms.Button();
-            this.groupBox_Data = new System.Windows.Forms.GroupBox();
-            this.button_Recover = new System.Windows.Forms.Button();
-            this.groupBox_ChemicalElement = new System.Windows.Forms.GroupBox();
-            this.comboBox_PeriodicTable = new System.Windows.Forms.ComboBox();
-            this.groupBox_OtherCommonlyUsedSymbols = new System.Windows.Forms.GroupBox();
-            this.comboBox_Constants = new System.Windows.Forms.ComboBox();
-            this.label_DefinedConstant = new System.Windows.Forms.Label();
-            this.label_Other = new System.Windows.Forms.Label();
-            this.label_ElementFormTwo = new System.Windows.Forms.Label();
-            this.label_ElementFormOne = new System.Windows.Forms.Label();
-            this.comboBox_Elem1 = new System.Windows.Forms.ComboBox();
-            this.comboBox_Elem = new System.Windows.Forms.ComboBox();
-            this.comboBox_ImgProperty = new System.Windows.Forms.ComboBox();
-            this.XmlTreeMenuStrip.SuspendLayout();
-            this.groupBox_CalculatingSymbols.SuspendLayout();
-            this.groupBox_Data.SuspendLayout();
-            this.groupBox_ChemicalElement.SuspendLayout();
-            this.groupBox_OtherCommonlyUsedSymbols.SuspendLayout();
-            this.SuspendLayout();
-            // 
-            // XmlTree_ZeroElementRules
-            // 
-            this.XmlTree_ZeroElementRules.ContextMenuStrip = this.XmlTreeMenuStrip;
-            this.XmlTree_ZeroElementRules.HideSelection = false;
-            this.XmlTree_ZeroElementRules.Location = new System.Drawing.Point(13, 11);
-            this.XmlTree_ZeroElementRules.Name = "XmlTree_ZeroElementRules";
-            this.XmlTree_ZeroElementRules.Size = new System.Drawing.Size(194, 523);
-            this.XmlTree_ZeroElementRules.TabIndex = 2;
-            this.XmlTree_ZeroElementRules.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.XmlTree_ZeroElementRules_BeforeSelect);
-            this.XmlTree_ZeroElementRules.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.XmlTree_ZeroElementRules_AfterSelect);
-            this.XmlTree_ZeroElementRules.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.XmlTree_ZeroElementRules_MouseDoubleClick);
-            // 
-            // XmlTreeMenuStrip
-            // 
-            this.XmlTreeMenuStrip.ImageScalingSize = new System.Drawing.Size(24, 24);
-            this.XmlTreeMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.新建标准库规则ToolStripMenuItem,
-            this.删除ToolStripMenuItem});
-            this.XmlTreeMenuStrip.Name = "XmlTreeMenuStrip";
-            this.XmlTreeMenuStrip.Size = new System.Drawing.Size(101, 48);
-            // 
-            // 新建标准库规则ToolStripMenuItem
-            // 
-            this.新建标准库规则ToolStripMenuItem.Name = "新建标准库规则ToolStripMenuItem";
-            this.新建标准库规则ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
-            this.新建标准库规则ToolStripMenuItem.Text = "新建";
-            this.新建标准库规则ToolStripMenuItem.Click += new System.EventHandler(this.AddTreeNode_Click);
-            // 
-            // 删除ToolStripMenuItem
-            // 
-            this.删除ToolStripMenuItem.Name = "删除ToolStripMenuItem";
-            this.删除ToolStripMenuItem.Size = new System.Drawing.Size(100, 22);
-            this.删除ToolStripMenuItem.Text = "删除";
-            this.删除ToolStripMenuItem.Click += new System.EventHandler(this.DeleteTreeNode_Click);
-            // 
-            // button_Cancel
-            // 
-            this.button_Cancel.Location = new System.Drawing.Point(552, 307);
-            this.button_Cancel.Name = "button_Cancel";
-            this.button_Cancel.Size = new System.Drawing.Size(103, 36);
-            this.button_Cancel.TabIndex = 24;
-            this.button_Cancel.Text = "离开";
-            this.button_Cancel.UseVisualStyleBackColor = true;
-            this.button_Cancel.Click += new System.EventHandler(this.button_Cancel_Click);
-            // 
-            // PeriodicTableSwitch
-            // 
-            this.PeriodicTableSwitch.BackColor = System.Drawing.SystemColors.Control;
-            this.PeriodicTableSwitch.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
-            this.PeriodicTableSwitch.Font = new System.Drawing.Font("楷体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PeriodicTableSwitch.Location = new System.Drawing.Point(866, 11);
-            this.PeriodicTableSwitch.Name = "PeriodicTableSwitch";
-            this.PeriodicTableSwitch.Size = new System.Drawing.Size(29, 167);
-            this.PeriodicTableSwitch.TabIndex = 33;
-            this.PeriodicTableSwitch.UseVisualStyleBackColor = false;
-            this.PeriodicTableSwitch.Click += new System.EventHandler(this.PeriodicTableSwitch_Click);
-            // 
-            // textbox_STDEditor
-            // 
-            this.textbox_STDEditor.Font = new System.Drawing.Font("宋体", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.textbox_STDEditor.Location = new System.Drawing.Point(232, 12);
-            this.textbox_STDEditor.Multiline = true;
-            this.textbox_STDEditor.Name = "textbox_STDEditor";
-            this.textbox_STDEditor.Size = new System.Drawing.Size(628, 166);
-            this.textbox_STDEditor.TabIndex = 30;
-            // 
-            // button_Ok
-            // 
-            this.button_Ok.Location = new System.Drawing.Point(443, 308);
-            this.button_Ok.Name = "button_Ok";
-            this.button_Ok.Size = new System.Drawing.Size(103, 36);
-            this.button_Ok.TabIndex = 23;
-            this.button_Ok.Text = "确认";
-            this.button_Ok.UseVisualStyleBackColor = true;
-            this.button_Ok.Click += new System.EventHandler(this.button_Ok_Click);
-            // 
-            // button_0
-            // 
-            this.button_0.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_0.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_0.Location = new System.Drawing.Point(272, 69);
-            this.button_0.Name = "button_0";
-            this.button_0.Size = new System.Drawing.Size(49, 40);
-            this.button_0.TabIndex = 26;
-            this.button_0.Text = "0";
-            this.button_0.UseVisualStyleBackColor = true;
-            this.button_0.Click += new System.EventHandler(this.button_0_Click);
-            // 
-            // button_9
-            // 
-            this.button_9.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_9.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_9.Location = new System.Drawing.Point(208, 70);
-            this.button_9.Name = "button_9";
-            this.button_9.Size = new System.Drawing.Size(49, 40);
-            this.button_9.TabIndex = 25;
-            this.button_9.Text = "9";
-            this.button_9.UseVisualStyleBackColor = true;
-            this.button_9.Click += new System.EventHandler(this.button_9_Click);
-            // 
-            // button_4
-            // 
-            this.button_4.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_4.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_4.Location = new System.Drawing.Point(208, 21);
-            this.button_4.Name = "button_4";
-            this.button_4.Size = new System.Drawing.Size(49, 40);
-            this.button_4.TabIndex = 24;
-            this.button_4.Text = "4";
-            this.button_4.UseVisualStyleBackColor = true;
-            this.button_4.Click += new System.EventHandler(this.button_4_Click);
-            // 
-            // button_5
-            // 
-            this.button_5.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_5.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_5.Location = new System.Drawing.Point(272, 21);
-            this.button_5.Name = "button_5";
-            this.button_5.Size = new System.Drawing.Size(49, 40);
-            this.button_5.TabIndex = 23;
-            this.button_5.Text = "5";
-            this.button_5.UseVisualStyleBackColor = true;
-            this.button_5.Click += new System.EventHandler(this.button_5_Click);
-            // 
-            // button_6
-            // 
-            this.button_6.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_6.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_6.Location = new System.Drawing.Point(21, 69);
-            this.button_6.Name = "button_6";
-            this.button_6.Size = new System.Drawing.Size(49, 40);
-            this.button_6.TabIndex = 22;
-            this.button_6.Text = "6";
-            this.button_6.UseVisualStyleBackColor = true;
-            this.button_6.Click += new System.EventHandler(this.button_6_Click);
-            // 
-            // button_7
-            // 
-            this.button_7.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_7.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_7.Location = new System.Drawing.Point(83, 70);
-            this.button_7.Name = "button_7";
-            this.button_7.Size = new System.Drawing.Size(49, 40);
-            this.button_7.TabIndex = 21;
-            this.button_7.Text = "7";
-            this.button_7.UseVisualStyleBackColor = true;
-            this.button_7.Click += new System.EventHandler(this.button_7_Click);
-            // 
-            // button_8
-            // 
-            this.button_8.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_8.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_8.Location = new System.Drawing.Point(144, 70);
-            this.button_8.Name = "button_8";
-            this.button_8.Size = new System.Drawing.Size(49, 40);
-            this.button_8.TabIndex = 20;
-            this.button_8.Text = "8";
-            this.button_8.UseVisualStyleBackColor = true;
-            this.button_8.Click += new System.EventHandler(this.button_8_Click);
-            // 
-            // button_Divide
-            // 
-            this.button_Divide.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_Divide.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_Divide.Location = new System.Drawing.Point(208, 120);
-            this.button_Divide.Name = "button_Divide";
-            this.button_Divide.Size = new System.Drawing.Size(49, 40);
-            this.button_Divide.TabIndex = 8;
-            this.button_Divide.Text = "/";
-            this.button_Divide.UseVisualStyleBackColor = true;
-            this.button_Divide.Click += new System.EventHandler(this.button_Divide_Click);
-            // 
-            // button_Or
-            // 
-            this.button_Or.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_Or.Font = new System.Drawing.Font("方正舒体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_Or.Location = new System.Drawing.Point(208, 218);
-            this.button_Or.Name = "button_Or";
-            this.button_Or.Size = new System.Drawing.Size(113, 40);
-            this.button_Or.TabIndex = 15;
-            this.button_Or.Text = "or";
-            this.button_Or.UseVisualStyleBackColor = true;
-            this.button_Or.Click += new System.EventHandler(this.button_Or_Click);
-            // 
-            // button_And
-            // 
-            this.button_And.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_And.Font = new System.Drawing.Font("方正舒体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_And.Location = new System.Drawing.Point(21, 218);
-            this.button_And.Name = "button_And";
-            this.button_And.Size = new System.Drawing.Size(172, 40);
-            this.button_And.TabIndex = 14;
-            this.button_And.Text = "and";
-            this.button_And.UseVisualStyleBackColor = true;
-            this.button_And.Click += new System.EventHandler(this.button_And_Click);
-            // 
-            // button_3
-            // 
-            this.button_3.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_3.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_3.Location = new System.Drawing.Point(144, 21);
-            this.button_3.Name = "button_3";
-            this.button_3.Size = new System.Drawing.Size(49, 40);
-            this.button_3.TabIndex = 19;
-            this.button_3.Text = "3";
-            this.button_3.UseVisualStyleBackColor = true;
-            this.button_3.Click += new System.EventHandler(this.button_3_Click);
-            // 
-            // button_2
-            // 
-            this.button_2.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_2.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_2.Location = new System.Drawing.Point(82, 21);
-            this.button_2.Name = "button_2";
-            this.button_2.Size = new System.Drawing.Size(49, 40);
-            this.button_2.TabIndex = 18;
-            this.button_2.Text = "2";
-            this.button_2.UseVisualStyleBackColor = true;
-            this.button_2.Click += new System.EventHandler(this.button_2_Click);
-            // 
-            // button_1
-            // 
-            this.button_1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_1.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_1.Location = new System.Drawing.Point(22, 21);
-            this.button_1.Name = "button_1";
-            this.button_1.Size = new System.Drawing.Size(49, 40);
-            this.button_1.TabIndex = 17;
-            this.button_1.Text = "1";
-            this.button_1.UseVisualStyleBackColor = true;
-            this.button_1.Click += new System.EventHandler(this.button_1_Click);
-            // 
-            // button_Equal
-            // 
-            this.button_Equal.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_Equal.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_Equal.Location = new System.Drawing.Point(272, 120);
-            this.button_Equal.Name = "button_Equal";
-            this.button_Equal.Size = new System.Drawing.Size(49, 40);
-            this.button_Equal.TabIndex = 16;
-            this.button_Equal.Text = "=";
-            this.button_Equal.UseVisualStyleBackColor = true;
-            this.button_Equal.Click += new System.EventHandler(this.button_Equal_Click);
-            // 
-            // button_RightParenthesis
-            // 
-            this.button_RightParenthesis.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_RightParenthesis.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_RightParenthesis.Location = new System.Drawing.Point(208, 169);
-            this.button_RightParenthesis.Name = "button_RightParenthesis";
-            this.button_RightParenthesis.Size = new System.Drawing.Size(49, 40);
-            this.button_RightParenthesis.TabIndex = 13;
-            this.button_RightParenthesis.Text = ")";
-            this.button_RightParenthesis.UseVisualStyleBackColor = true;
-            this.button_RightParenthesis.Click += new System.EventHandler(this.button_RightParenthesis_Click);
-            // 
-            // button_LeftParenthesis
-            // 
-            this.button_LeftParenthesis.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_LeftParenthesis.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_LeftParenthesis.Location = new System.Drawing.Point(144, 169);
-            this.button_LeftParenthesis.Name = "button_LeftParenthesis";
-            this.button_LeftParenthesis.Size = new System.Drawing.Size(49, 40);
-            this.button_LeftParenthesis.TabIndex = 12;
-            this.button_LeftParenthesis.Text = "(";
-            this.button_LeftParenthesis.UseVisualStyleBackColor = true;
-            this.button_LeftParenthesis.Click += new System.EventHandler(this.button_LeftParenthesis_Click);
-            // 
-            // button_Less
-            // 
-            this.button_Less.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_Less.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_Less.Location = new System.Drawing.Point(82, 169);
-            this.button_Less.Name = "button_Less";
-            this.button_Less.Size = new System.Drawing.Size(49, 40);
-            this.button_Less.TabIndex = 11;
-            this.button_Less.Text = "<";
-            this.button_Less.UseVisualStyleBackColor = true;
-            this.button_Less.Click += new System.EventHandler(this.button_Less_Click);
-            // 
-            // button_More
-            // 
-            this.button_More.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_More.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_More.Location = new System.Drawing.Point(21, 169);
-            this.button_More.Name = "button_More";
-            this.button_More.Size = new System.Drawing.Size(49, 40);
-            this.button_More.TabIndex = 10;
-            this.button_More.Text = ">";
-            this.button_More.UseVisualStyleBackColor = true;
-            this.button_More.Click += new System.EventHandler(this.button_More_Click);
-            // 
-            // button_Multiply
-            // 
-            this.button_Multiply.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_Multiply.Font = new System.Drawing.Font("方正舒体", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_Multiply.Location = new System.Drawing.Point(144, 120);
-            this.button_Multiply.Name = "button_Multiply";
-            this.button_Multiply.Size = new System.Drawing.Size(49, 40);
-            this.button_Multiply.TabIndex = 9;
-            this.button_Multiply.Text = "*";
-            this.button_Multiply.UseVisualStyleBackColor = true;
-            this.button_Multiply.Click += new System.EventHandler(this.button_Multiply_Click);
-            // 
-            // groupBox_CalculatingSymbols
-            // 
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_0);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_9);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_4);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_5);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_6);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_7);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_8);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_Divide);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_Or);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_And);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_3);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_2);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_1);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_Equal);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_RightParenthesis);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_LeftParenthesis);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_Less);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_More);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_Multiply);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_Subtract);
-            this.groupBox_CalculatingSymbols.Controls.Add(this.button_Plus);
-            this.groupBox_CalculatingSymbols.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.groupBox_CalculatingSymbols.Location = new System.Drawing.Point(316, 16);
-            this.groupBox_CalculatingSymbols.Name = "groupBox_CalculatingSymbols";
-            this.groupBox_CalculatingSymbols.Size = new System.Drawing.Size(347, 271);
-            this.groupBox_CalculatingSymbols.TabIndex = 31;
-            this.groupBox_CalculatingSymbols.TabStop = false;
-            this.groupBox_CalculatingSymbols.Text = "运算符号";
-            // 
-            // button_Subtract
-            // 
-            this.button_Subtract.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_Subtract.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_Subtract.Location = new System.Drawing.Point(82, 120);
-            this.button_Subtract.Name = "button_Subtract";
-            this.button_Subtract.Size = new System.Drawing.Size(49, 40);
-            this.button_Subtract.TabIndex = 7;
-            this.button_Subtract.Text = "-";
-            this.button_Subtract.UseVisualStyleBackColor = true;
-            this.button_Subtract.Click += new System.EventHandler(this.button_Subtract_Click);
-            // 
-            // button_Plus
-            // 
-            this.button_Plus.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
-            this.button_Plus.Font = new System.Drawing.Font("方正舒体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button_Plus.Location = new System.Drawing.Point(21, 120);
-            this.button_Plus.Name = "button_Plus";
-            this.button_Plus.Size = new System.Drawing.Size(49, 40);
-            this.button_Plus.TabIndex = 6;
-            this.button_Plus.Text = "+";
-            this.button_Plus.UseVisualStyleBackColor = true;
-            this.button_Plus.Click += new System.EventHandler(this.button_Plus_Click);
-            // 
-            // groupBox_Data
-            // 
-            this.groupBox_Data.Controls.Add(this.groupBox_CalculatingSymbols);
-            this.groupBox_Data.Controls.Add(this.button_Recover);
-            this.groupBox_Data.Controls.Add(this.groupBox_ChemicalElement);
-            this.groupBox_Data.Controls.Add(this.groupBox_OtherCommonlyUsedSymbols);
-            this.groupBox_Data.Controls.Add(this.button_Ok);
-            this.groupBox_Data.Controls.Add(this.button_Cancel);
-            this.groupBox_Data.FlatStyle = System.Windows.Forms.FlatStyle.System;
-            this.groupBox_Data.Location = new System.Drawing.Point(232, 184);
-            this.groupBox_Data.Name = "groupBox_Data";
-            this.groupBox_Data.Size = new System.Drawing.Size(669, 351);
-            this.groupBox_Data.TabIndex = 29;
-            this.groupBox_Data.TabStop = false;
-            // 
-            // button_Recover
-            // 
-            this.button_Recover.Location = new System.Drawing.Point(18, 321);
-            this.button_Recover.Name = "button_Recover";
-            this.button_Recover.Size = new System.Drawing.Size(161, 23);
-            this.button_Recover.TabIndex = 25;
-            this.button_Recover.Text = "恢复至出厂默认值";
-            this.button_Recover.UseVisualStyleBackColor = true;
-            this.button_Recover.Visible = false;
-            this.button_Recover.Click += new System.EventHandler(this.button_Recover_Click);
-            // 
-            // groupBox_ChemicalElement
-            // 
-            this.groupBox_ChemicalElement.Controls.Add(this.comboBox_PeriodicTable);
-            this.groupBox_ChemicalElement.Location = new System.Drawing.Point(18, 16);
-            this.groupBox_ChemicalElement.Name = "groupBox_ChemicalElement";
-            this.groupBox_ChemicalElement.Size = new System.Drawing.Size(281, 40);
-            this.groupBox_ChemicalElement.TabIndex = 5;
-            this.groupBox_ChemicalElement.TabStop = false;
-            this.groupBox_ChemicalElement.Text = "化学元素";
-            // 
-            // comboBox_PeriodicTable
-            // 
-            this.comboBox_PeriodicTable.FormattingEnabled = true;
-            this.comboBox_PeriodicTable.Location = new System.Drawing.Point(113, 14);
-            this.comboBox_PeriodicTable.Name = "comboBox_PeriodicTable";
-            this.comboBox_PeriodicTable.Size = new System.Drawing.Size(148, 20);
-            this.comboBox_PeriodicTable.TabIndex = 1;
-            this.comboBox_PeriodicTable.SelectedIndexChanged += new System.EventHandler(this.comboBox_PeriodicTable_SelectedIndexChanged);
-            this.comboBox_PeriodicTable.KeyDown += new System.Windows.Forms.KeyEventHandler(this.comboBox_PeriodicTable_KeyDown);
-            // 
-            // groupBox_OtherCommonlyUsedSymbols
-            // 
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.comboBox_Constants);
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.label_DefinedConstant);
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.label_Other);
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.label_ElementFormTwo);
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.label_ElementFormOne);
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.comboBox_Elem1);
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.comboBox_Elem);
-            this.groupBox_OtherCommonlyUsedSymbols.Controls.Add(this.comboBox_ImgProperty);
-            this.groupBox_OtherCommonlyUsedSymbols.Location = new System.Drawing.Point(18, 68);
-            this.groupBox_OtherCommonlyUsedSymbols.Name = "groupBox_OtherCommonlyUsedSymbols";
-            this.groupBox_OtherCommonlyUsedSymbols.Size = new System.Drawing.Size(281, 219);
-            this.groupBox_OtherCommonlyUsedSymbols.TabIndex = 3;
-            this.groupBox_OtherCommonlyUsedSymbols.TabStop = false;
-            this.groupBox_OtherCommonlyUsedSymbols.Text = "其它常用符号";
-            // 
-            // comboBox_Constants
-            // 
-            this.comboBox_Constants.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.comboBox_Constants.FormattingEnabled = true;
-            this.comboBox_Constants.Location = new System.Drawing.Point(113, 175);
-            this.comboBox_Constants.Name = "comboBox_Constants";
-            this.comboBox_Constants.Size = new System.Drawing.Size(148, 20);
-            this.comboBox_Constants.TabIndex = 5;
-            this.comboBox_Constants.SelectedIndexChanged += new System.EventHandler(this.comboBox_Constants_SelectedIndexChanged);
-            // 
-            // label_DefinedConstant
-            // 
-            this.label_DefinedConstant.AutoSize = true;
-            this.label_DefinedConstant.Location = new System.Drawing.Point(6, 178);
-            this.label_DefinedConstant.Name = "label_DefinedConstant";
-            this.label_DefinedConstant.Size = new System.Drawing.Size(77, 12);
-            this.label_DefinedConstant.TabIndex = 19;
-            this.label_DefinedConstant.Text = "已定义常数:";
-            // 
-            // label_Other
-            // 
-            this.label_Other.AutoSize = true;
-            this.label_Other.Location = new System.Drawing.Point(6, 131);
-            this.label_Other.Name = "label_Other";
-            this.label_Other.Size = new System.Drawing.Size(41, 12);
-            this.label_Other.TabIndex = 10;
-            this.label_Other.Text = "其它:";
-            // 
-            // label_ElementFormTwo
-            // 
-            this.label_ElementFormTwo.AutoSize = true;
-            this.label_ElementFormTwo.Location = new System.Drawing.Point(6, 84);
-            this.label_ElementFormTwo.Name = "label_ElementFormTwo";
-            this.label_ElementFormTwo.Size = new System.Drawing.Size(77, 12);
-            this.label_ElementFormTwo.TabIndex = 9;
-            this.label_ElementFormTwo.Text = "元素形式二:";
-            // 
-            // label_ElementFormOne
-            // 
-            this.label_ElementFormOne.AutoSize = true;
-            this.label_ElementFormOne.Location = new System.Drawing.Point(6, 34);
-            this.label_ElementFormOne.Name = "label_ElementFormOne";
-            this.label_ElementFormOne.Size = new System.Drawing.Size(77, 12);
-            this.label_ElementFormOne.TabIndex = 8;
-            this.label_ElementFormOne.Text = "元素形式一:";
-            // 
-            // comboBox_Elem1
-            // 
-            this.comboBox_Elem1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.comboBox_Elem1.FormattingEnabled = true;
-            this.comboBox_Elem1.Location = new System.Drawing.Point(113, 31);
-            this.comboBox_Elem1.Name = "comboBox_Elem1";
-            this.comboBox_Elem1.Size = new System.Drawing.Size(148, 20);
-            this.comboBox_Elem1.TabIndex = 2;
-            this.comboBox_Elem1.SelectedIndexChanged += new System.EventHandler(this.comboBox_Elem1_SelectedIndexChanged);
-            // 
-            // comboBox_Elem
-            // 
-            this.comboBox_Elem.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.comboBox_Elem.FormattingEnabled = true;
-            this.comboBox_Elem.Location = new System.Drawing.Point(113, 81);
-            this.comboBox_Elem.Name = "comboBox_Elem";
-            this.comboBox_Elem.Size = new System.Drawing.Size(148, 20);
-            this.comboBox_Elem.TabIndex = 3;
-            this.comboBox_Elem.SelectedIndexChanged += new System.EventHandler(this.comboBox_Elem2_SelectedIndexChanged);
-            // 
-            // comboBox_ImgProperty
-            // 
-            this.comboBox_ImgProperty.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.comboBox_ImgProperty.FormattingEnabled = true;
-            this.comboBox_ImgProperty.Location = new System.Drawing.Point(113, 128);
-            this.comboBox_ImgProperty.Name = "comboBox_ImgProperty";
-            this.comboBox_ImgProperty.Size = new System.Drawing.Size(148, 20);
-            this.comboBox_ImgProperty.TabIndex = 4;
-            this.comboBox_ImgProperty.SelectedIndexChanged += new System.EventHandler(this.comboBox_ImgProperty_SelectedIndexChanged);
-            // 
-            // Form_ZeroElementRules
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.AutoSize = true;
-            this.ClientSize = new System.Drawing.Size(906, 539);
-            this.Controls.Add(this.XmlTree_ZeroElementRules);
-            this.Controls.Add(this.PeriodicTableSwitch);
-            this.Controls.Add(this.textbox_STDEditor);
-            this.Controls.Add(this.groupBox_Data);
-            this.MaximizeBox = false;
-            this.MaximumSize = new System.Drawing.Size(922, 578);
-            this.MinimumSize = new System.Drawing.Size(922, 578);
-            this.Name = "Form_ZeroElementRules";
-            this.ShowIcon = false;
-            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
-            this.Text = "Form_ZeroElementRules";
-            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_ZeroElementRules_FormClosing);
-            this.Load += new System.EventHandler(this.Form_ZeroElementRules_Load);
-            this.XmlTreeMenuStrip.ResumeLayout(false);
-            this.groupBox_CalculatingSymbols.ResumeLayout(false);
-            this.groupBox_Data.ResumeLayout(false);
-            this.groupBox_ChemicalElement.ResumeLayout(false);
-            this.groupBox_OtherCommonlyUsedSymbols.ResumeLayout(false);
-            this.groupBox_OtherCommonlyUsedSymbols.PerformLayout();
-            this.ResumeLayout(false);
-            this.PerformLayout();
-
-        }
-
-        #endregion
-        private System.Windows.Forms.TreeView XmlTree_ZeroElementRules;
-        private System.Windows.Forms.ContextMenuStrip XmlTreeMenuStrip;
-        private System.Windows.Forms.ToolStripMenuItem 新建标准库规则ToolStripMenuItem;
-        private System.Windows.Forms.ToolStripMenuItem 删除ToolStripMenuItem;
-        private System.Windows.Forms.Button button_Cancel;
-        private System.Windows.Forms.Button PeriodicTableSwitch;
-        private System.Windows.Forms.TextBox textbox_STDEditor;
-        private System.Windows.Forms.Button button_Ok;
-        private System.Windows.Forms.Button button_0;
-        private System.Windows.Forms.Button button_9;
-        private System.Windows.Forms.Button button_4;
-        private System.Windows.Forms.Button button_5;
-        private System.Windows.Forms.Button button_6;
-        private System.Windows.Forms.Button button_7;
-        private System.Windows.Forms.Button button_8;
-        private System.Windows.Forms.Button button_Divide;
-        private System.Windows.Forms.Button button_Or;
-        private System.Windows.Forms.Button button_And;
-        private System.Windows.Forms.Button button_3;
-        private System.Windows.Forms.Button button_2;
-        private System.Windows.Forms.Button button_1;
-        private System.Windows.Forms.Button button_Equal;
-        private System.Windows.Forms.Button button_RightParenthesis;
-        private System.Windows.Forms.Button button_LeftParenthesis;
-        private System.Windows.Forms.Button button_Less;
-        private System.Windows.Forms.Button button_More;
-        private System.Windows.Forms.Button button_Multiply;
-        private System.Windows.Forms.GroupBox groupBox_CalculatingSymbols;
-        private System.Windows.Forms.Button button_Subtract;
-        private System.Windows.Forms.Button button_Plus;
-        private System.Windows.Forms.GroupBox groupBox_Data;
-        private System.Windows.Forms.Button button_Recover;
-        private System.Windows.Forms.GroupBox groupBox_ChemicalElement;
-        private System.Windows.Forms.ComboBox comboBox_PeriodicTable;
-        private System.Windows.Forms.GroupBox groupBox_OtherCommonlyUsedSymbols;
-        private System.Windows.Forms.ComboBox comboBox_Constants;
-        private System.Windows.Forms.Label label_DefinedConstant;
-        private System.Windows.Forms.Label label_Other;
-        private System.Windows.Forms.Label label_ElementFormTwo;
-        private System.Windows.Forms.Label label_ElementFormOne;
-        private System.Windows.Forms.ComboBox comboBox_Elem1;
-        private System.Windows.Forms.ComboBox comboBox_Elem;
-        private System.Windows.Forms.ComboBox comboBox_ImgProperty;
-    }
-}

+ 0 - 1424
OTSPartA_STDEditor/UI/Form_ZeroElementRules.cs

@@ -1,1424 +0,0 @@
-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.Windows.Forms;
-using System.Xml;
-using System.Xml.Linq;
-
-namespace OTSPartA_STDEditor
-{
-    public partial class Form_ZeroElementRules : Form
-    {
-        //国际化
-        Language lan;
-        System.Collections.Hashtable table;
-        string STDDBAddress = Application.StartupPath + "\\Config\\SysData\\" + "OTSCleanlinesSTD.db";
-        //string STDDBAddress_backup = Application.StartupPath + "\\Config\\SysData\\LibBackup\\" + "OTSCleanlinesSTD_backup.db";
-        string STDDBAddress_backupDirectory = Application.StartupPath + "\\Config\\SysData\\LibBackup\\";
-
-        //元素周期表
-        Form_PeriodicTable form_PeriodicTable = null;
-
-        public Form_ZeroElementRules(string DBAddress)
-        {
-            InitializeComponent();
-            STDDBAddress = DBAddress;
-                                                                                                                                                                            
-            X = this.Width;
-            Y = this.Height;
-            setTag(this);
-        }
-
-        private void Form_ZeroElementRules_Load(object sender, EventArgs e)
-        {
-            //初始化comboBox
-            this.comboBox_Elem1.Items.Add("first_elem");
-            this.comboBox_Elem1.Items.Add("second_elem");
-            this.comboBox_Elem1.Items.Add("third_elem");
-            this.comboBox_Elem1.Items.Add("fourth_elem");
-            this.comboBox_Elem1.Items.Add("fifth_elem");
-            this.comboBox_Elem1.Items.Add("sixth_elem");
-            this.comboBox_Elem1.Items.Add("seventh_elem");
-            this.comboBox_Elem1.Items.Add("eighth_elem");
-            this.comboBox_Elem1.Items.Add("ninth_elem");
-            this.comboBox_Elem1.Items.Add("tenth_elem");
-            comboBox_Elem1.SelectedIndex = comboBox_Elem1.Items.IndexOf("first_elem");
-
-            this.comboBox_Elem.Items.Add("Element#1");
-            this.comboBox_Elem.Items.Add("Element#2");
-            this.comboBox_Elem.Items.Add("Element#3");
-            this.comboBox_Elem.Items.Add("Element#4");
-            this.comboBox_Elem.Items.Add("Element#5");
-            this.comboBox_Elem.Items.Add("Element#6");
-            this.comboBox_Elem.Items.Add("Element#7");
-            this.comboBox_Elem.Items.Add("Element#8");
-            this.comboBox_Elem.Items.Add("Element#9");
-            this.comboBox_Elem.Items.Add("Element#10");
-            comboBox_Elem.SelectedIndex = comboBox_Elem.Items.IndexOf("Element#1");
-
-            this.comboBox_ImgProperty.Items.Add("Dmax");
-            this.comboBox_ImgProperty.Items.Add("Dmin");
-            this.comboBox_ImgProperty.Items.Add("Aspect");
-            this.comboBox_ImgProperty.Items.Add("Dperp");
-            this.comboBox_ImgProperty.Items.Add("Dmean");
-            this.comboBox_ImgProperty.Items.Add("Area");
-            this.comboBox_ImgProperty.Items.Add("Dferet");
-            this.comboBox_ImgProperty.Items.Add("With");
-            this.comboBox_ImgProperty.Items.Add("Height");
-            this.comboBox_ImgProperty.Items.Add("Perimeter");
-            this.comboBox_ImgProperty.Items.Add("Dinscr");
-            this.comboBox_ImgProperty.Items.Add("Orientation");
-            this.comboBox_ImgProperty.Items.Add("Delong");
-            this.comboBox_ImgProperty.Items.Add("Aspectelong");
-            this.comboBox_ImgProperty.Items.Add("Dequalcircle");
-            this.comboBox_ImgProperty.Items.Add("Vedio");
-
-            comboBox_ImgProperty.SelectedIndex = comboBox_ImgProperty.Items.IndexOf("Dmax");
-
-            string[] PeriodicTable = { "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hq", "TI", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Mc", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Unb" };
-            comboBox_PeriodicTable.Items.AddRange(PeriodicTable);
-            AutoCompleteStringCollection sc = new AutoCompleteStringCollection();
-            sc.AddRange(PeriodicTable);
-            this.comboBox_PeriodicTable.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
-            this.comboBox_PeriodicTable.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
-            this.comboBox_PeriodicTable.AutoCompleteCustomSource = sc;
-
-            LoadZeroElementRulesToTreeControl(STDDBAddress, XmlTree_ZeroElementRules.Nodes);
-            LoadConstants(STDDBAddress);
-
-            this.textbox_STDEditor.Text = "";
-
-            lan = new Language(this);
-            table = lan.GetNameTable("Form_ZeroElementRules");
-
-            if (table["language"].ToString() == "EN")
-            {
-                //panel_OTSPeriodicTable.BackgroundImage = global::OTSPartA_STDEditor.Properties.Resources.PeriodicTable_EN;
-                PeriodicTableSwitch.BackgroundImage = global::OTSPartA_STDEditor.Properties.Resources.STDEditoName;
-                PeriodicTableSwitch.Text = "";
-            }
-            else
-            {
-                //panel_OTSPeriodicTable.BackgroundImage = global::OTSPartA_STDEditor.Properties.Resources.PeriodicTable_ZH;
-                PeriodicTableSwitch.Text = "元素周期表";
-            }
-
-            
-
-            Size size = Screen.PrimaryScreen.WorkingArea.Size;
-            Left = (size.Width - Width) / 2;
-            Top = (size.Height - Height) / 2;
-            WindowState = FormWindowState.Normal;
-
-           
-
-            //panel_OTSPeriodicTable.Visible = true;
-            //this.Width = this.Width - panel_OTSPeriodicTable.Width - 5;
-
-            this.XmlTree_ZeroElementRules.HideSelection = false;//失去焦点后不隐藏选中节点
-            XmlTree_ZeroElementRules.Focus();
-            if (XmlTree_ZeroElementRules.Nodes.Count > 0)
-            {
-                XmlTree_ZeroElementRules.SelectedNode = XmlTree_ZeroElementRules.Nodes[0];
-                XmlTree_ZeroElementRules_AfterSelect(XmlTree_ZeroElementRules, new TreeViewEventArgs(XmlTree_ZeroElementRules.SelectedNode));
-            }
-
-          
-
-        }
-
-
-        
-
-        void LoadZeroElementRulesToTreeControl(string DBAddress, TreeNodeCollection XmlTree_ZeroElementRules)
-        {
-            try
-            {
-                System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + DBAddress + "'");
-                m_dbConnection.Open();
-                System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from ZeroElementRules", m_dbConnection);
-                DataSet ds = new DataSet();
-                m_dataAdapter.Fill(ds);
-                DataTable dt = ds.Tables[0];
-
-                if (dt != null)
-                {
-                    if (dt.Rows.Count > 0)
-                    {
-                        foreach (DataRow item in dt.Rows)
-                        {
-                            TreeNode new_child = new TreeNode();//定义一个TreeNode节点对象
-                            new_child.Text = item["ZeroElement"].ToString() + "=0";
-                            new_child.Tag = item["Expression"];
-                            XmlTree_ZeroElementRules.Add(new_child);
-                        }
-                    }
-                }
-            }
-            catch (Exception ee)
-            {
-                MessageBox.Show(ee.ToString());
-            }
-        }
-
-        void LoadConstants(string STDDBAddress)
-        {
-            try
-            {
-                System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + STDDBAddress + "'");
-                m_dbConnection.Open();
-                System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from Constants", m_dbConnection);
-                DataSet ds = new DataSet();
-                m_dataAdapter.Fill(ds);
-                DataTable dt = ds.Tables[0];
-                string ConstantsStr = "";
-                if (dt.Rows.Count > 0)
-                {
-                    ConstantsStr = dt.Rows[0][0].ToString();
-                }
-                ConstantsStr = ConstantsStr.Replace(" ", "");
-                string[] ConstantsStr2 = ConstantsStr.Split(',');
-                comboBox_Constants.Items.Clear();
-                comboBox_Constants.Items.AddRange(ConstantsStr2);
-                m_dbConnection.Close();
-            }
-            catch (Exception ee)
-            {
-                MessageBox.Show(ee.ToString());
-            }
-        }
-
-        private void comboBox_Elem1_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            string newStr = comboBox_Elem1.SelectedItem.ToString();
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, newStr);
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + newStr.Length, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void comboBox_Elem2_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            string newStr = comboBox_Elem.SelectedItem.ToString();
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, newStr);
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + newStr.Length, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void comboBox_ImgProperty_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            string newStr = comboBox_ImgProperty.SelectedItem.ToString();
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, newStr);
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + newStr.Length, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_Plus_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "+");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_Subtract_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "-");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_Multiply_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "*");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_Divide_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "/");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret(); ;
-        }
-
-        private void button_More_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, ">");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_Less_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "<");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_LeftParenthesis_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "(");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_RightParenthesis_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, ")");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_Equal_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "=");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        //除选中点以外其它节点前景色置灰
-        private void SetGrayExceptSelectedNode(TreeView Tree, TreeNode SelectedNode)
-        {
-            foreach (TreeNode node in Tree.Nodes)
-            {
-                if (node != SelectedNode)
-                {
-                    node.ForeColor = Color.Gray;
-                }
-            }
-        }
-        //恢复所有节点颜色为可用
-        private void SetBlackAllNodes(TreeView Tree)
-        {
-            foreach (TreeNode node in Tree.Nodes)
-            {
-                node.ForeColor = Color.Black;
-            }
-        }
-
-        //删除
-        private void DeleteTreeNode_Click(object sender, EventArgs e)
-        {
-            try
-            {
-                TreeView XmlTree = (TreeView)XmlTreeMenuStrip.SourceControl;
-                if (XmlTree.SelectedNode != null)
-                {
-                    if (XmlTree != null)
-                    {
-                        if (XmlTree.SelectedNode.NextNode != null)
-                        {
-                            TreeNode Temp = XmlTree.SelectedNode.NextNode;
-                            XmlTree.SelectedNode.Remove();
-                            XmlTree.SelectedNode = Temp;
-                        }
-                        else if (XmlTree.SelectedNode.PrevNode != null)
-                        {
-                            TreeNode Temp = XmlTree.SelectedNode.PrevNode;
-                            XmlTree.SelectedNode.Remove();
-                            XmlTree.SelectedNode = Temp;
-                        }
-                        else
-                        {
-                            XmlTree.SelectedNode.Remove();
-                            XmlTree.SelectedNode = null;
-                        }
-                    }
-                }
-                else
-                {
-                    MessageBox.Show("No nodes are selected!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                }
-            }
-            catch (Exception ex)
-            {
-                MessageBox.Show(ex.ToString(), "Tip");
-            }
-        }
-
-        //新建
-        private void AddTreeNode_Click(object sender, EventArgs e)
-        {
-            try
-            {
-                if (XmlTree_ZeroElementRules.SelectedNode != null)
-                {
-                    if (XmlTree_ZeroElementRules.SelectedNode.Text.Contains("="))
-                    {
-                        if (!comboBox_PeriodicTable.Items.Contains(XmlTree_ZeroElementRules.SelectedNode.Text.Split('=')[0]))
-                        {
-                            MessageBox.Show(XmlTree_ZeroElementRules.SelectedNode.Text + "Item,It`s format of name is error, The correct format is : element name =0", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                            return;
-                        }
-                    }
-                    else
-                    {
-                        MessageBox.Show(XmlTree_ZeroElementRules.SelectedNode.Text + "Item,It`s format of name is error, The correct format is : element name =0", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                        return;
-                    }
-                    //判断textbox_STDEditor
-                    if (!Checktextbox_STDEditor())
-                    {
-                        return;
-                    }
-                    XmlTree_ZeroElementRules.SelectedNode.Tag = this.textbox_STDEditor.Text;
-                }
-
-                TreeNode new_child = new TreeNode();//定义一个TreeNode节点对象
-                TreeView XmlTree = (TreeView)XmlTreeMenuStrip.SourceControl;
-
-                if (XmlTreeMenuStrip.SourceControl.Name == "XmlTree_ZeroElementRules")
-                {
-                    new_child.Text = "NewElement=0";
-                    new_child.Tag = "NewRules";
-                    textbox_STDEditor.Text = "NewRules";
-                }
-
-                XmlTree.Nodes.Add(new_child);
-                XmlTree.SelectedNode = null;
-                XmlTree.SelectedNode = new_child;
-            }
-            catch (Exception ex)
-            {
-                MessageBox.Show(ex.ToString(), "Tip");
-            }
-        }
-
-  
-        void SaveXmlTreeDataToZeroElementRules(string DBAddress)
-        {
-            System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + DBAddress + "'");
-            m_dbConnection.Open();
-
-            System.Data.SQLite.SQLiteCommand cmm = m_dbConnection.CreateCommand();
-
-            cmm.CommandText = "drop table ZeroElementRules";
-            cmm.ExecuteNonQuery();
-
-            cmm.CommandText = "CREATE TABLE ZeroElementRules (ZeroElement TEXT,UsingElementList TEXT, UsingImgPropertyList TEXT,UsingOtherPropertyList TEXT,Expression TEXT)";
-            cmm.ExecuteNonQuery();
-
-            System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from ZeroElementRules", m_dbConnection);
-            System.Data.SQLite.SQLiteCommandBuilder qLiteCommandBuilder = new System.Data.SQLite.SQLiteCommandBuilder(m_dataAdapter);
-
-            DataSet ds = new DataSet();
-            m_dataAdapter.Fill(ds, "ZeroElementRules");
-            DataTable dt = ds.Tables["ZeroElementRules"];
-
-            for (int num = 0; num < XmlTree_ZeroElementRules.Nodes.Count; num++)
-            {
-                string UsingElementList = "";
-                string UsingImgPropertyList = "";
-                string UsingOtherPropertyList = "";
-                List<string> UsingElementL = new List<string>();
-                List<string> UsingImgPropertyL = new List<string>();
-                List<string> UsingOtherPropertyL = new List<string>();
-
-                string str_RemoveBlank = "";
-                str_RemoveBlank = XmlTree_ZeroElementRules.Nodes[num].Tag.ToString().Replace(" ", "");
-                string[] str_Removeand = System.Text.RegularExpressions.Regex.Split(str_RemoveBlank, "and", System.Text.RegularExpressions.RegexOptions.None);
-                List<string> str_Removeandor = new List<string>();
-                for (int i = 0; i < str_Removeand.Length; i++)
-                {
-                    str_Removeandor.AddRange(System.Text.RegularExpressions.Regex.Split(str_Removeand[i], "or", System.Text.RegularExpressions.RegexOptions.None));
-                }
-                List<string> list_all = new List<string>();
-                for (int i = 0; i < str_Removeandor.Count; i++)
-                {
-                    list_all.AddRange(str_Removeandor[i].Split(new char[] { '+', '-', '*', '/', '=', '>', '<', '(', ')' }));
-                }
-                for (int i = 0; i < list_all.Count; i++)
-                {
-                    //周期元素?
-                    if (this.comboBox_PeriodicTable.Items.Contains(list_all[i]))
-                    {
-                        if (!UsingElementL.Contains(list_all[i]))
-                        {
-                            UsingElementL.Add(list_all[i]);
-                        }
-                    }
-                    //first_elem?
-                    if (this.comboBox_Elem1.Items.Contains(list_all[i]))
-                    {
-                        if (!UsingOtherPropertyL.Contains(list_all[i]))
-                        {
-                            UsingOtherPropertyL.Add(list_all[i]);
-                        }
-                    }
-                    //Element1?
-                    if (this.comboBox_Elem.Items.Contains(list_all[i]))
-                    {
-                        if (!UsingOtherPropertyL.Contains(list_all[i]))
-                        {
-                            UsingOtherPropertyL.Add(list_all[i]);
-                        }
-                    }
-                    //其它元素?
-                    if (this.comboBox_ImgProperty.Items.Contains(list_all[i]))
-                    {
-                        if (!UsingImgPropertyL.Contains(list_all[i]))
-                        {
-                            UsingImgPropertyL.Add(list_all[i]);
-                        }
-                    }
-
-                }
-
-                if (UsingElementL.Count > 0)
-                {
-                    for (int i = 0; i < UsingElementL.Count - 1; i++)
-                    {
-                        UsingElementList += UsingElementL[i] + ",";
-                    }
-                    UsingElementList += UsingElementL[UsingElementL.Count - 1];
-                }
-
-                if (UsingImgPropertyL.Count > 0)
-                {
-                    for (int i = 0; i < UsingImgPropertyL.Count - 1; i++)
-                    {
-                        UsingImgPropertyList += UsingImgPropertyL[i] + ",";
-                    }
-                    UsingImgPropertyList += UsingImgPropertyL[UsingImgPropertyL.Count - 1];
-                }
-
-                if (UsingOtherPropertyL.Count > 0)
-                {
-                    for (int i = 0; i < UsingOtherPropertyL.Count - 1; i++)
-                    {
-                        UsingOtherPropertyList += UsingOtherPropertyL[i] + ",";
-                    }
-                    UsingOtherPropertyList += UsingOtherPropertyL[UsingOtherPropertyL.Count - 1];
-                }
-
-                DataRow newRow = dt.NewRow();
-                newRow["ZeroElement"] = XmlTree_ZeroElementRules.Nodes[num].Text.Split('=')[0];
-                newRow["UsingElementList"] = UsingElementList;
-                newRow["UsingImgPropertyList"] = UsingImgPropertyList;
-                newRow["UsingOtherPropertyList"] = UsingOtherPropertyList;
-                newRow["Expression"] = XmlTree_ZeroElementRules.Nodes[num].Tag;
-                dt.Rows.Add(newRow);
-            }
-            m_dataAdapter.Update(ds, "ZeroElementRules");
-            m_dbConnection.Close();
-
-            MessageBox.Show("Save successful!", "Tip");
-        }
-
-        //元素周期表开关
-        private void PeriodicTableSwitch_Click(object sender, EventArgs e)
-        {
-            //if (PeriodicTableSwitch.BackColor == SystemColors.Control)
-            //{
-            //    ////this.Resize -= new System.EventHandler(this.Form_ZeroElementRules_Resize);
-            //    //panel_OTSPeriodicTable.Visible = false;
-            //    //this.Width = this.Width - panel_OTSPeriodicTable.Width;
-            //    ////this.Resize += new System.EventHandler(this.Form_ZeroElementRules_Resize);
-
-            //    //PeriodicTableSwitch.BackColor = SystemColors.ControlDark;
-
-            //    ////if (Language == "English")
-            //    ////{
-            //    ////    PeriodicTableSwitch.Text = "Close PeriodicTable";
-            //    ////}
-            //    ////else if(Language == "Chinese")
-            //    ////{
-            //    ////    PeriodicTableSwitch.Text = "关闭元素周期表";
-            //    ////}
-
-            //    if (form_PeriodicTable == null)
-            //    {
-            //        form_PeriodicTable = new Form_PeriodicTable();
-            //        form_PeriodicTable.Show();
-            //        form_PeriodicTable.Location = new Point(this.Location.X + this.Width - 14, this.Location.Y);
-            //    }
-            //    else
-            //    {
-            //        if (form_PeriodicTable.IsDisposed)
-            //        {
-            //            form_PeriodicTable = new Form_PeriodicTable();
-            //            form_PeriodicTable.Show();
-            //            form_PeriodicTable.Location = new Point(this.Location.X + this.Width - 14, this.Location.Y);
-            //        }
-            //        else
-            //        {
-            //            form_PeriodicTable.Activate();
-            //        }
-            //    }
-
-            //}
-            //else if (PeriodicTableSwitch.BackColor == SystemColors.ControlDark)
-            //{
-            //    //this.Resize -= new System.EventHandler(this.Form_ZeroElementRules_Resize);
-            //    //this.Width = this.Width + panel_OTSPeriodicTable.Width + 5;
-            //    panel_OTSPeriodicTable.Visible = true;
-            //    //this.Resize += new System.EventHandler(this.Form_ZeroElementRules_Resize);
-
-            //    PeriodicTableSwitch.BackColor = SystemColors.Control;
-
-            //    //if (Language == "English")
-            //    //{
-            //    //    PeriodicTableSwitch.Text = "Open PeriodicTable";
-            //    //}
-            //    //else if (Language == "Chinese")
-            //    //{
-            //    //    PeriodicTableSwitch.Text = "打开元素周期表";
-            //    //}
-
-            //    //textbox_STDEditor.Focus();
-
-            //    groupBox_CalculatingSymbols.Focus();
-            //}
-
-            if (form_PeriodicTable == null)
-            {
-                form_PeriodicTable = new Form_PeriodicTable();
-                form_PeriodicTable.Show();
-                form_PeriodicTable.Location = new Point(this.Location.X + this.Width - 14, this.Location.Y);
-            }
-            else
-            {
-                if (form_PeriodicTable.IsDisposed)
-                {
-                    form_PeriodicTable = new Form_PeriodicTable();
-                    form_PeriodicTable.Show();
-                    form_PeriodicTable.Location = new Point(this.Location.X + this.Width - 14, this.Location.Y);
-                }
-                else
-                {
-                    form_PeriodicTable.Activate();
-                }
-            }
-        }
-
-        private void button_Ok_Click(object sender, EventArgs e)
-        {
-            if (XmlTree_ZeroElementRules.SelectedNode != null)
-            {
-                if (XmlTree_ZeroElementRules.SelectedNode.Text.Contains("="))
-                {
-                    if (!comboBox_PeriodicTable.Items.Contains(XmlTree_ZeroElementRules.SelectedNode.Text.Split('=')[0]))
-                    {
-                        MessageBox.Show(XmlTree_ZeroElementRules.SelectedNode.Text + "Item,It`s format of name is error, The correct format is : element name =0", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                        return;
-                    }
-                }
-                else
-                {
-                    MessageBox.Show(XmlTree_ZeroElementRules.SelectedNode.Text + "Item,It`s format of name is error, The correct format is : element name =0", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                    return;
-                }
-                //判断textbox_STDEditor
-                if (!Checktextbox_STDEditor())
-                {
-                    return;
-                }
-                XmlTree_ZeroElementRules.SelectedNode.Tag = this.textbox_STDEditor.Text;
-            }
-
-            //SaveXmlTreeDataToXml(Address);
-            SaveXmlTreeDataToZeroElementRules(STDDBAddress);
-            this.Close();
-        }
-
-        private void button_Cancel_Click(object sender, EventArgs e)
-        {
-            this.Close();
-        }
-
-        //元素下拉选择输入
-        private void comboBox_PeriodicTable_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            if (comboBox_PeriodicTable.Text != null && comboBox_PeriodicTable.SelectedItem != null)
-            {
-                string newStr = comboBox_PeriodicTable.SelectedItem.ToString();
-                comboBox_PeriodicTable.Text = null;
-                int index = textbox_STDEditor.SelectionStart;
-                textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, newStr);
-                textbox_STDEditor.Focus();
-                textbox_STDEditor.Select(index + newStr.Length, 0);
-                textbox_STDEditor.ScrollToCaret();
-            }
-        }
-
-        //元素自身text按回车键输入
-        private void comboBox_PeriodicTable_KeyDown(object sender, KeyEventArgs e)
-        {
-            if (e.KeyValue == 13)
-            {
-                if (comboBox_PeriodicTable.Text != null && comboBox_PeriodicTable.Text != "")
-                {
-                    this.textbox_STDEditor.Text += comboBox_PeriodicTable.Text.ToString();
-                    comboBox_PeriodicTable.Text = null;
-                }
-            }
-        }
-
-        //表达式规则检查
-        private bool Checktextbox_STDEditor()
-        {
-            if (textbox_STDEditor.Text == "" || textbox_STDEditor.Text == null)
-            {
-                textbox_STDEditor.Focus();
-                MessageBox.Show("The content of Standard library cannot be empty!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                return false;
-            }
-            string str_RemoveBlank = textbox_STDEditor.Text.ToString().Replace(" ", "");
-            str_RemoveBlank = str_RemoveBlank.Replace("\r\n", "");
-            //分割符号检验
-            string[] Symbol = { "and", "or", "+", "-", "*", "/", "=", ">", "<" };
-            for (int i = 0; i < Symbol.Length; i++)
-            {
-                for (int j = 0; j < Symbol.Length; j++)
-                {
-                    if ((Symbol[i] + Symbol[j]) != ">=" && (Symbol[i] + Symbol[j]) != "<=")
-                    {
-                        if (str_RemoveBlank.Contains(Symbol[i] + Symbol[j]))
-                        {
-                            MessageBox.Show("Invalid string exists:" + Symbol[i] + Symbol[j], "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                            return false;
-                        }
-                    }
-                }
-                if (str_RemoveBlank.Contains(Symbol[i] + ")") || str_RemoveBlank.Contains("(" + Symbol[i]))
-                {
-                    MessageBox.Show("Invalid string exists:" + Symbol[i] + ")", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                    return false;
-                }
-                if (str_RemoveBlank.Contains("(" + Symbol[i]))
-                {
-                    MessageBox.Show("Invalid string exists:" + "(" + Symbol[i], "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                    return false;
-                }
-            }
-            if ((str_RemoveBlank != null) && (str_RemoveBlank != ""))
-            {
-                //左右括号匹配检验
-                int BracketsNum = 0;
-                for (int i = 0; i < str_RemoveBlank.Length; i++)
-                {
-                    if (str_RemoveBlank[i] == '(') BracketsNum++;
-                    if (str_RemoveBlank[i] == ')') BracketsNum--;
-                }
-                if (BracketsNum != 0)
-                {
-                    MessageBox.Show("Number of left and right parentheses does not match!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                    return false;
-                }
-                //首字符检测
-                if ((str_RemoveBlank[0] == '+') || (str_RemoveBlank[0] == '-') || (str_RemoveBlank[0] == '*') || (str_RemoveBlank[0] == '/') || (str_RemoveBlank[0] == '>') || (str_RemoveBlank[0] == '<') || (str_RemoveBlank[0] == '=') || (str_RemoveBlank[0] == ')') || (str_RemoveBlank[str_RemoveBlank.Length - 1] == '('))
-                {
-                    MessageBox.Show("First character is error!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                    return false;
-                }
-
-                if (str_RemoveBlank.Length >= 3)
-                {
-                    if ((str_RemoveBlank.Substring(0, 3) == "and") || (str_RemoveBlank.Substring(0, 3) == "end"))
-                    {
-                        MessageBox.Show("First character is error!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                        return false;
-                    }
-                }
-            }
-
-            //forth_elem干扰or分隔符,故先行去掉
-            //str_RemoveBlank = str_RemoveBlank.Replace("fourth_elem", "");
-
-            string[] str_Removeand = System.Text.RegularExpressions.Regex.Split(str_RemoveBlank, "and", System.Text.RegularExpressions.RegexOptions.None);
-            List<string> str_Removeandor = new List<string>();
-            for (int i = 0; i < str_Removeand.Length; i++)
-            {
-                str_Removeandor.AddRange(System.Text.RegularExpressions.Regex.Split(str_Removeand[i], "or", System.Text.RegularExpressions.RegexOptions.None));
-            }
-            List<string> list_all = new List<string>();
-            for (int i = 0; i < str_Removeandor.Count; i++)
-            {
-                list_all.AddRange(str_Removeandor[i].Split(new char[] { '+', '-', '*', '/', '=', '>', '<', '(', ')' }));
-            }
-
-            //常量
-            List<string> Constantslist = new List<string>();
-            for (int j = 0; j < comboBox_Constants.Items.Count; j++)
-            {
-                Constantslist.Add(comboBox_Constants.Items[j].ToString().Split('=')[0]);
-            }
-
-            for (int i = 0; i < list_all.Count; i++)
-            {
-                //周期元素?
-                if (this.comboBox_PeriodicTable.Items.Contains(list_all[i]))
-                {
-                    continue;
-                }
-                //first_elem?
-                if (this.comboBox_Elem1.Items.Contains(list_all[i]))
-                {
-                    continue;
-                }
-                //Element1?
-                if (this.comboBox_Elem.Items.Contains(list_all[i]))
-                {
-                    continue;
-                }
-                //其它元素?
-                if (this.comboBox_ImgProperty.Items.Contains(list_all[i]))
-                {
-                    continue;
-                }
-                //常量?
-                if (Constantslist.Contains(list_all[i]))
-                {
-                    continue;
-                }
-                //数字?
-                double DNum = 0;
-                if (double.TryParse(list_all[i], out DNum))
-                {
-                    continue;
-                }
-                //>=? <=?等其它情况
-                if (list_all[i] == "")
-                {
-                    continue;
-                }
-                //true false?
-                if ((list_all[i] == "true") || (list_all[i] == "false"))
-                {
-                    continue;
-                }
-
-                MessageBox.Show("Please check whether the input rules are correct, error characters:" + list_all[i], "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                return false;
-            }
-
-            //检测是否有<>= true,false
-            if (!textbox_STDEditor.Text.ToString().Contains("<") && !textbox_STDEditor.Text.ToString().Contains(">") && !textbox_STDEditor.Text.ToString().Contains("=") && textbox_STDEditor.Text.ToString() != "true" && textbox_STDEditor.Text.ToString() != "false")
-            {
-                MessageBox.Show("Expressions have no effect!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                return false;
-            }
-
-            return true;
-        }
-
-
-
-        private void button_And_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "and");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 3, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_Or_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "or");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 2, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void comboBox_Constants_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            if (comboBox_Constants.SelectedItem != null)
-            {
-                string newStr = comboBox_Constants.SelectedItem.ToString().Split('=')[0];
-                int index = textbox_STDEditor.SelectionStart;
-                textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, newStr);
-                textbox_STDEditor.Focus();
-                textbox_STDEditor.Select(index + newStr.Length, 0);
-                textbox_STDEditor.ScrollToCaret();
-            }
-        }
-
-        private void button_Recover_Click(object sender, EventArgs e)
-        {
-            XmlDocument doc = new XmlDocument();
-            try
-            {
-                //System.IO.File.Copy(Address_backup, Address, true);
-                //doc.Load(Address_backup);
-
-                XmlTree_ZeroElementRules.Nodes.Clear();
-                //LoadXmlToTreeControl(doc,XmlTree_ZeroElementRules.Nodes);
-
-                string STDDBAddress_backup = "";
-                string[] files = System.IO.Directory.GetFiles(STDDBAddress_backupDirectory);//得到文件
-                foreach (var file in files)
-                {
-                    if (".db".IndexOf(file.Substring(file.LastIndexOf(".") + 1)) > -1)
-                    {
-                        STDDBAddress_backup = file;
-                    }
-                }
-                LoadZeroElementRulesToTreeControl(STDDBAddress_backup, XmlTree_ZeroElementRules.Nodes);
-
-                XmlTree_ZeroElementRules.Focus();
-                if (XmlTree_ZeroElementRules.Nodes.Count > 0)
-                {
-                    XmlTree_ZeroElementRules.SelectedNode = XmlTree_ZeroElementRules.Nodes[0];
-                    XmlTree_ZeroElementRules_AfterSelect(XmlTree_ZeroElementRules, new TreeViewEventArgs(XmlTree_ZeroElementRules.SelectedNode));
-                }
-                else
-                {
-                    textbox_STDEditor.Text = "";
-                }
-            }
-            catch (Exception ex)
-            {
-                MessageBox.Show("Recovery failed!" + "\n" + ex.Message.ToString(), "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-            }
-        }
-
-        private void XmlTree_ZeroElementRules_MouseDoubleClick(object sender, MouseEventArgs e)
-        {
-            if (e.Button == MouseButtons.Left)
-            {
-                Point ClickPoint = new Point(e.X, e.Y);
-                TreeNode CurrentNode = XmlTree_ZeroElementRules.GetNodeAt(ClickPoint);
-                if (CurrentNode != null)//判断你点的是不是一个节点
-                {
-                    XmlTree_ZeroElementRules.SelectedNode = CurrentNode;//选中这个节点
-                    //this.textbox_STDEditor.Text = XmlTree_ZeroElementRules.SelectedNode.Tag.ToString();
-                    XmlTree_ZeroElementRules.LabelEdit = true;
-                    XmlTree_ZeroElementRules.SelectedNode.BeginEdit();
-                }
-            }
-        }
-
-        private bool CheckConstants(string ConstantName)
-        {
-
-            for (int num = 0; num < XmlTree_ZeroElementRules.Nodes.Count; num++)
-            {
-                if (XmlTree_ZeroElementRules.Nodes[num].Tag.ToString().Contains(ConstantName))
-                {
-                    XmlTree_ZeroElementRules.SelectedNode = XmlTree_ZeroElementRules.Nodes[num];
-                    SetGrayExceptSelectedNode(XmlTree_ZeroElementRules, XmlTree_ZeroElementRules.SelectedNode);
-                    DialogResult result = MessageBox.Show("Closing failed," + XmlTree_ZeroElementRules.Nodes[num].Text + "Item ,it`s rule input contains this constant!", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Warning);
-                    return false;
-                }
-            }
-            return true;
-        }
-
-        private void XmlTree_ZeroElementRules_BeforeSelect(object sender, TreeViewCancelEventArgs e)
-        {
-            if (XmlTree_ZeroElementRules.SelectedNode != null)
-            {
-                if (XmlTree_ZeroElementRules.SelectedNode.Text.Contains("="))
-                {
-                    if (!comboBox_PeriodicTable.Items.Contains(XmlTree_ZeroElementRules.SelectedNode.Text.Split('=')[0]))
-                    {
-                        MessageBox.Show(XmlTree_ZeroElementRules.SelectedNode.Text + "Item,It`s format of name is error, The correct format is : element name =0", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                        SetGrayExceptSelectedNode(XmlTree_ZeroElementRules, XmlTree_ZeroElementRules.SelectedNode);
-                        e.Cancel = true;
-                        return;
-                    }
-                }
-                else
-                {
-                    MessageBox.Show(XmlTree_ZeroElementRules.SelectedNode.Text + "Item,It`s format of name is error, The correct format is : element name =0", "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                    SetGrayExceptSelectedNode(XmlTree_ZeroElementRules, XmlTree_ZeroElementRules.SelectedNode);
-                    e.Cancel = true;
-                    return;
-                }
-                if (!Checktextbox_STDEditor())
-                {
-                    SetGrayExceptSelectedNode(XmlTree_ZeroElementRules, XmlTree_ZeroElementRules.SelectedNode);
-                    e.Cancel = true;
-                    return;
-                }
-                XmlTree_ZeroElementRules.SelectedNode.Tag = this.textbox_STDEditor.Text;
-            }
-        }
-
-        private void XmlTree_ZeroElementRules_AfterSelect(object sender, TreeViewEventArgs e)
-        {
-            SetBlackAllNodes(XmlTree_ZeroElementRules);
-            this.textbox_STDEditor.Text = XmlTree_ZeroElementRules.SelectedNode.Tag.ToString();
-        }
-
-        private void textbox_STDEditor_Leave(object sender, EventArgs e)
-        {
-            XmlTree_ZeroElementRules.Focus();
-        }
-
-        #region  为配合textbox_STDEditor_Leave时事件,点击其它groupbox组件时使焦点转移
-        private void Form_ConstantsEditor_Click(object sender, EventArgs e)
-        {
-            groupBox_CalculatingSymbols.Focus();
-        }
-        private void groupBox_Data_Click(object sender, EventArgs e)
-        {
-            groupBox_Data.Focus();
-        }
-        private void groupBox_ChemicalElement_Click(object sender, EventArgs e)
-        {
-            groupBox_ChemicalElement.Focus();
-        }
-        private void groupBox_OtherCommonlyUsedSymbols_Click(object sender, EventArgs e)
-        {
-            groupBox_OtherCommonlyUsedSymbols.Focus();
-        }
-        private void groupBox_CalculatingSymbols_Click(object sender, EventArgs e)
-        {
-            groupBox_CalculatingSymbols.Focus();
-        }
-        #endregion
-        private void button_1_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "1");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_2_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "2");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_3_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "3");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_4_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "4");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_5_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "5");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_6_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "6");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_7_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "7");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_8_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "8");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_9_Click(object sender, EventArgs e)
-        {
-            //textbox_STDEditor 中的光标
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "9");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-        private void button_0_Click(object sender, EventArgs e)
-        {
-            int index = textbox_STDEditor.SelectionStart;
-            textbox_STDEditor.Text = textbox_STDEditor.Text.Insert(index, "0");
-
-            textbox_STDEditor.Focus();
-            textbox_STDEditor.Select(index + 1, 0);
-            textbox_STDEditor.ScrollToCaret();
-        }
-
-
-        private float X = 1;
-        private float Y = 1;
-        //float AmplificationFactor = 1;
-        private void Form_ZeroElementRules_Resize(object sender, EventArgs e)
-        {
-
-        }
-
-        private void setTag(Control cons)
-        {
-            foreach (Control con in cons.Controls)
-            {
-                con.Tag = con.Width + ":" + con.Height + ":" + con.Left + ":" + con.Top + ":" + con.Font.Size;
-                if (con.Controls.Count > 0)
-                    setTag(con);
-            }
-        }
-
-        private void setControls(float newx, float newy, Control cons)
-        {
-            foreach (Control con in cons.Controls)
-            {
-                if(con.Name== "Form_ZeroElementRules")
-                {
-                    continue;
-                }
-                if (false)
-                {
-
-                }
-                else
-                {
-                    string[] mytag = con.Tag.ToString().Split(':');
-
-                    float a = Convert.ToSingle(mytag[0]) * newx;
-                    con.Width = (int)a;
-
-                    a = Convert.ToSingle(mytag[1]) * newy;
-                    con.Height = (int)(a);
-
-                    a = Convert.ToSingle(mytag[2]) * newx;
-                    con.Left = (int)(a);
-
-                    a = Convert.ToSingle(mytag[3]) * newy;
-                    con.Top = (int)(a);
-
-                    Single currentSize;
-
-                    if (con.GetType().ToString() == "System.Windows.Forms.Label")
-                    {
-                        currentSize = Convert.ToSingle(mytag[4]) * ((newx + newy) / 2);
-                        //currentSize = 6f;
-                    }
-                    else
-                    {
-                        if (Math.Max(newx, newy) < 1)
-                        {
-                            currentSize = Convert.ToSingle(mytag[4]) * 1;
-                        }
-                        else
-                        {
-                            currentSize = Convert.ToSingle(mytag[4]) * Math.Max(newx, newy);
-
-                        }
-                    }
-
-                    con.Font = new Font(con.Font.Name, currentSize, con.Font.Style, con.Font.Unit);
-                    if (con.Controls.Count > 0)
-                    {
-                        setControls(newx, newy, con);
-                    }
-
-                }
-            }
-        }
-
-        #region
-        //string Address_backup = Application.StartupPath + "\\Config\\SysData\\OTSParticleSTD_backup.xml";
-        //string Address = Application.StartupPath + "\\Config\\SysData\\OTSParticleSTD.xml";
-
-        //private void Form_ZeroElementRules_Load(object sender, EventArgs e)
-        //{
-        //    XmlDocument doc = new XmlDocument();
-        //    doc.Load(Address);
-        //    LoadXmlToTreeControl(doc, XmlTree_ZeroElementRules.Nodes);
-        //}
-        //保存xmltree内容到xml文件
-        //void SaveXmlTreeDataToXml(string Address)
-        //{
-        //    XDocument xdoc = XDocument.Load(Address);
-        //    IEnumerable<XElement> elements = from ele in xdoc.Descendants("XMLData") select ele;
-
-        //    var item = (from ele1 in elements.Elements("Collection")
-        //                where ele1.Attribute("RegName").Value.Equals("ZeroElementRules")
-        //                select ele1).FirstOrDefault();
-        //    if (item != null)
-        //    {
-        //        item.Remove();
-        //    }
-
-        //    XElement ZeroElement = new XElement("Collection");
-        //    ZeroElement.SetAttributeValue("RegName", "ZeroElementRules");
-        //    elements.ElementAt(0).Add(ZeroElement);
-
-        //    for (int num = 0; num < XmlTree_ZeroElementRules.Nodes.Count; num++)
-        //    {
-        //        string UsingElementList = "";
-        //        string UsingImgPropertyList = "";
-        //        string UsingOtherPropertyList = "";
-        //        List<string> UsingElementL = new List<string>();
-        //        List<string> UsingImgPropertyL = new List<string>();
-        //        List<string> UsingOtherPropertyL = new List<string>();
-
-        //        string str_RemoveBlank = "";
-        //        //forth_elem干扰or分隔符,故先行去掉
-        //        if (XmlTree_ZeroElementRules.Nodes[num].Tag.ToString().Contains("forth_elem"))
-        //        {
-        //            str_RemoveBlank = str_RemoveBlank.Replace("forth_elem", "");
-        //            UsingOtherPropertyL.Add("forth_elem");
-        //        }
-
-        //        str_RemoveBlank = XmlTree_ZeroElementRules.Nodes[num].Tag.ToString().Replace(" ", "");
-        //        string[] str_Removeand = System.Text.RegularExpressions.Regex.Split(str_RemoveBlank, "and", System.Text.RegularExpressions.RegexOptions.None);
-        //        List<string> str_Removeandor = new List<string>();
-        //        for (int i = 0; i < str_Removeand.Length; i++)
-        //        {
-        //            str_Removeandor.AddRange(System.Text.RegularExpressions.Regex.Split(str_Removeand[i], "or", System.Text.RegularExpressions.RegexOptions.None));
-        //        }
-        //        List<string> list_all = new List<string>();
-        //        for (int i = 0; i < str_Removeandor.Count; i++)
-        //        {
-        //            list_all.AddRange(str_Removeandor[i].Split(new char[] { '+', '-', '*', '/', '=', '>', '<', '(', ')' }));
-        //        }
-        //        for (int i = 0; i < list_all.Count; i++)
-        //        {
-        //            //周期元素?
-        //            if (this.comboBox_PeriodicTable.Items.Contains(list_all[i]))
-        //            {
-        //                if (!UsingElementL.Contains(list_all[i]))
-        //                {
-        //                    UsingElementL.Add(list_all[i]);
-        //                }
-        //            }
-        //            //first_elem?
-        //            if (this.comboBox_Elem1.Items.Contains(list_all[i]))
-        //            {
-        //                if (!UsingOtherPropertyL.Contains(list_all[i]))
-        //                {
-        //                    UsingOtherPropertyL.Add(list_all[i]);
-        //                }
-        //            }
-        //            //Element1?
-        //            if (this.comboBox_Elem.Items.Contains(list_all[i]))
-        //            {
-        //                if (!UsingOtherPropertyL.Contains(list_all[i]))
-        //                {
-        //                    UsingOtherPropertyL.Add(list_all[i]);
-        //                }
-        //            }
-        //            //其它元素?
-        //            if (this.comboBox_ImgProperty.Items.Contains(list_all[i]))
-        //            {
-        //                if (!UsingImgPropertyL.Contains(list_all[i]))
-        //                {
-        //                    UsingImgPropertyL.Add(list_all[i]);
-        //                }
-        //            }
-
-        //        }
-
-        //        if (UsingElementL.Count > 0)
-        //        {
-        //            for (int i = 0; i < UsingElementL.Count - 1; i++)
-        //            {
-        //                UsingElementList += UsingElementL[i] + ",";
-        //            }
-        //            UsingElementList += UsingElementL[UsingElementL.Count - 1];
-        //        }
-
-        //        if (UsingImgPropertyL.Count > 0)
-        //        {
-        //            for (int i = 0; i < UsingImgPropertyL.Count - 1; i++)
-        //            {
-        //                UsingImgPropertyList += UsingImgPropertyL[i] + ",";
-        //            }
-        //            UsingImgPropertyList += UsingImgPropertyL[UsingImgPropertyL.Count - 1];
-        //        }
-
-        //        if (UsingOtherPropertyL.Count > 0)
-        //        {
-        //            for (int i = 0; i < UsingOtherPropertyL.Count - 1; i++)
-        //            {
-        //                UsingOtherPropertyList += UsingOtherPropertyL[i] + ",";
-        //            }
-        //            UsingOtherPropertyList += UsingOtherPropertyL[UsingOtherPropertyL.Count - 1];
-        //        }
-
-        //        XElement EleName = new XElement("Member");
-        //        EleName.SetAttributeValue("ZeroElement", XmlTree_ZeroElementRules.Nodes[num].Text.Split('=')[0]);
-        //        EleName.SetAttributeValue("UsingElementList", UsingElementList);
-        //        EleName.SetAttributeValue("UsingImgPropertyList", UsingImgPropertyList);
-        //        EleName.SetAttributeValue("UsingOtherPropertyList", UsingOtherPropertyList);
-        //        EleName.SetAttributeValue("Expression", XmlTree_ZeroElementRules.Nodes[num].Tag);
-        //        ZeroElement.Add(EleName);
-        //    }
-        //    xdoc.Save(Address);
-        //}
-        //XmlTree_ZeroElementRules
-        //void LoadXmlToTreeControl(XmlDocument xml, TreeNodeCollection XmlTree_ZeroElementRules)
-        //{
-        //    XmlNode root = xml.SelectSingleNode("XMLData");
-        //    XmlNodeList root2 = root.SelectNodes("Collection");
-        //    for (int j = 0; j < root2.Count; j++)
-        //    {
-        //        if (root2[j].Attributes["RegName"].Value.ToString() == "ZeroElementRules")
-        //        {
-        //            XmlNodeList childlist = root2[j].ChildNodes;
-        //            for (int i = 0; i < childlist.Count; i++)
-        //            {
-        //                TreeNode new_child = new TreeNode();//定义一个TreeNode节点对象
-        //                new_child.Text = childlist[i].Attributes["ZeroElement"].Value + "=0";
-        //                new_child.Tag = childlist[i].Attributes["Expression"].Value;
-        //                XmlTree_ZeroElementRules.Add(new_child);
-        //            }
-        //        }
-        //    }
-        //    XmlNode root3 = root.SelectSingleNode("Member");
-        //    string ConstantsStr = root3.Attributes["value"].Value;
-        //    ConstantsStr = ConstantsStr.Replace(" ", "");
-        //    string[] ConstantsStr2 = ConstantsStr.Split(',');
-        //    this.comboBox_Constants.Items.Clear();
-        //    this.comboBox_Constants.Items.AddRange(ConstantsStr2);
-        //}
-        //private void button_Backup_Click(object sender, EventArgs e)
-        //{
-        //    if (XmlTree_ZeroElementRules.SelectedNode != null)
-        //    {
-        //        if (XmlTree_ZeroElementRules.SelectedNode.Text.Contains("="))
-        //        {
-        //            if (!comboBox_PeriodicTable.Items.Contains(XmlTree_ZeroElementRules.SelectedNode.Text.Split('=')[0]))
-        //            {
-        //                MessageBox.Show(XmlTree_ZeroElementRules.SelectedNode.Text + table["message9"].ToString(), table["message32"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
-        //                return;
-        //            }
-        //        }
-        //        else
-        //        {
-        //            MessageBox.Show(XmlTree_ZeroElementRules.SelectedNode.Text + table["message9"].ToString(), table["message32"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
-        //            return;
-        //        }
-        //        //判断textbox_STDEditor
-        //        if (!Checktextbox_STDEditor())
-        //        {
-        //            return;
-        //        }
-        //        XmlTree_ZeroElementRules.SelectedNode.Tag = this.textbox_STDEditor.Text;
-        //    }
-        //    try
-        //    {
-        //        SaveFileDialog saveFile = new SaveFileDialog();
-        //        saveFile.Title = table["message23"].ToString();
-        //        saveFile.Filter = table["message24"].ToString();
-        //        saveFile.OverwritePrompt = true;  //是否覆盖当前文件
-        //        saveFile.RestoreDirectory = true;  //还原上次目录
-        //        if (saveFile.ShowDialog() == DialogResult.OK)
-        //        {
-
-        //            System.IO.File.Copy(Address, saveFile.FileName, true);
-        //            SaveXmlTreeDataToXml(saveFile.FileName);
-        //            MessageBox.Show(table["message25"].ToString(), table["message32"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
-        //        }
-        //        else
-        //        {
-        //            return;
-        //        }
-        //    }
-        //    catch (Exception ex)
-        //    {
-        //        MessageBox.Show(ex.Message);
-        //    }
-        //}
-        #endregion
-
-        private void Form_ZeroElementRules_FormClosing(object sender, FormClosingEventArgs e)
-        {
-            if (form_PeriodicTable != null)
-            {
-                form_PeriodicTable.Close();
-            }
-        }
-    }
-}

+ 0 - 123
OTSPartA_STDEditor/UI/Form_ZeroElementRules.resx

@@ -1,123 +0,0 @@
-<?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>
-  <metadata name="XmlTreeMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>17, 17</value>
-  </metadata>
-</root>

+ 259 - 0
SpectrumSTDEditor/BaseClass/FileHelper.cs

@@ -0,0 +1,259 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+
+namespace OTSModelSharp.ServiceCenter
+{
+    public static class FileHelper
+    {
+        static XmlDocument Hardwareconfigdoc=null;
+        public static string GetFolderName(string a_strPathName)
+        {
+            if (a_strPathName == "Untitled")
+            {
+                return null;
+            }
+            string folderName = a_strPathName.Substring(0, a_strPathName.LastIndexOf("\\"));
+
+            return folderName;
+       
+        }
+        public static string GetXMLInformations(string Name)
+        {
+            try
+            {
+                XmlDocument doc;
+                string value = string.Empty;
+                if (Hardwareconfigdoc == null)
+                {
+                    string xmlFilePath = System.Configuration.ConfigurationManager.ConnectionStrings["XMLFileName"].ConnectionString;
+
+
+                    Hardwareconfigdoc = new XmlDocument();
+
+                    Hardwareconfigdoc.Load(xmlFilePath);    //加载Xml文件 
+                    doc = Hardwareconfigdoc;
+
+                }
+                else
+                {
+                    doc = Hardwareconfigdoc;
+                }
+
+
+                XmlElement root = doc.DocumentElement;   //获取根节点  
+
+                XmlNodeList mainNodes = root.GetElementsByTagName("Member"); //获取子节点集合  
+
+                foreach (XmlNode node in mainNodes)
+                {
+                    //获取Name属性值
+                    string name = ((XmlElement)node).GetAttribute("RegName");
+                    if (name.Equals(Name))
+                    {
+                        value = ((XmlElement)node).GetAttribute("Value");
+                        break;
+                    }
+                }
+                return value;
+            }
+            catch (Exception)
+            {
+                return "";
+            }
+        }
+        /// <summary>
+        /// 获取XML节点参数
+        /// </summary>
+        /// <param name="Name">节点参数名称</param>
+        /// <returns>节点参数</returns>
+        public static string GetIfDelayQuantify()
+        {
+            try
+            {
+                XmlDocument doc;
+                string value = string.Empty;
+                if (Hardwareconfigdoc == null)
+                {
+                    string xmlFilePath = System.Configuration.ConfigurationManager.ConnectionStrings["XMLFileName"].ConnectionString;
+
+                   
+                    Hardwareconfigdoc = new XmlDocument();
+
+                    Hardwareconfigdoc.Load(xmlFilePath);    //加载Xml文件 
+                    doc = Hardwareconfigdoc;
+
+                }
+                else 
+                {
+                    doc = Hardwareconfigdoc;
+                }
+                
+
+                XmlElement root = doc.DocumentElement;   //获取根节点  
+
+                XmlNodeList mainNodes = root.GetElementsByTagName("Member"); //获取子节点集合  
+
+                foreach (XmlNode node in mainNodes)
+                {
+                    //获取Name属性值
+                    string name = ((XmlElement)node).GetAttribute("RegName");
+                    if (name.Equals("EDSName"))
+                    {
+                       
+                            value = ((XmlElement)node).GetAttribute("DelayQuantify");
+                       
+                        break;
+                    }
+                }
+                return value;
+            }
+            catch (Exception)
+            {
+                return "false";
+            }
+        }
+        public static bool GetIfTranslateWeightPercentageToAtomicPercentage()
+        {
+            try
+            {
+                XmlDocument doc;
+                string value = string.Empty;
+                if (Hardwareconfigdoc == null)
+                {
+                    string xmlFilePath = System.Configuration.ConfigurationManager.ConnectionStrings["XMLFileName"].ConnectionString;
+
+
+                    Hardwareconfigdoc = new XmlDocument();
+
+                    Hardwareconfigdoc.Load(xmlFilePath);    //加载Xml文件 
+                    doc = Hardwareconfigdoc;
+
+                }
+                else
+                {
+                    doc = Hardwareconfigdoc;
+                }
+
+
+                XmlElement root = doc.DocumentElement;   //获取根节点  
+
+                XmlNodeList mainNodes = root.GetElementsByTagName("Member"); //获取子节点集合  
+
+                foreach (XmlNode node in mainNodes)
+                {
+                    //获取Name属性值
+                    string name = ((XmlElement)node).GetAttribute("RegName");
+                    if (name.Equals("EDSName"))
+                    {
+
+                        value = ((XmlElement)node).GetAttribute("WeightPercentageToAtomicPercentage");
+
+                        break;
+                    }
+                }
+                return Convert.ToBoolean(value);
+            }
+            catch (Exception)
+            {
+                return false;
+            }
+        }
+        public static bool GetIfAquireClearParticleImage()
+        {
+            try
+            {
+                XmlDocument doc;
+                string value = string.Empty;
+                if (Hardwareconfigdoc == null)
+                {
+                    string xmlFilePath = System.Configuration.ConfigurationManager.ConnectionStrings["XMLFileName"].ConnectionString;
+
+
+                    Hardwareconfigdoc = new XmlDocument();
+
+                    Hardwareconfigdoc.Load(xmlFilePath);    //加载Xml文件 
+                    doc = Hardwareconfigdoc;
+
+                }
+                else
+                {
+                    doc = Hardwareconfigdoc;
+                }
+
+
+                XmlElement root = doc.DocumentElement;   //获取根节点  
+
+                XmlNodeList mainNodes = root.GetElementsByTagName("Member"); //获取子节点集合  
+
+                foreach (XmlNode node in mainNodes)
+                {
+                    //获取Name属性值
+                    string name = ((XmlElement)node).GetAttribute("RegName");
+                    if (name.Equals("AcquireClearParticleImage"))
+                    {
+
+                        value = ((XmlElement)node).GetAttribute("Value");
+
+                        break;
+                    }
+                }
+                return Convert.ToBoolean(value);
+            }
+            catch (Exception)
+            {
+                return false;
+            }
+        }
+        public static string GetOxfordInputSourceType()
+        {
+            try
+            {
+               
+
+                string value = string.Empty;
+                XmlDocument doc = new XmlDocument();
+                if (Hardwareconfigdoc == null)
+                {
+                    string xmlFilePath = System.Configuration.ConfigurationManager.ConnectionStrings["XMLFileName"].ConnectionString;
+
+
+                    Hardwareconfigdoc = new XmlDocument();
+
+                    Hardwareconfigdoc.Load(xmlFilePath);    //加载Xml文件 
+                    doc = Hardwareconfigdoc;
+
+                }
+                else
+                {
+                    doc = Hardwareconfigdoc;
+                }
+               
+
+                XmlElement root = doc.DocumentElement;   //获取根节点  
+
+                XmlNodeList mainNodes = root.GetElementsByTagName("Member"); //获取子节点集合  
+
+                foreach (XmlNode node in mainNodes)
+                {
+                    //获取Name属性值
+                    string name = ((XmlElement)node).GetAttribute("RegName");
+                    if (name.Equals("SemControllerName"))
+                    {
+                        value = ((XmlElement)node).GetAttribute("ImageInputSources");
+                        break;
+                    }
+                }
+                return value;
+            }
+            catch (Exception)
+            {
+                return "";
+            }
+        }
+    }
+}

+ 76 - 72
SpectrumSTDEditor/BaseClass/STDdata.cs

@@ -10,22 +10,22 @@ namespace SpectrumSTDEditor
     {
         //string s_STDId = "";
         string s_StrName = "";
-        string s_Color = "#FFFFFF";
-        string s_KeyElementList = "";
-        string s_SubElementList = "";
-        string s_UsingImgPropertyList = "";
-        string s_UsingOtherPropertyList = "";
-        string s_Expression = "";
+        string s_Color = "000000";
+        //string s_KeyElementList = "";
+        //string s_SubElementList = "";
+        //string s_UsingImgPropertyList = "";
+        //string s_UsingOtherPropertyList = "";
+        //string s_Expression = "";
         string s_Hardness = "";
         string s_Density = "";
-        string s_Electrical_conductivity = "";
+        //string s_Electrical_conductivity = "";
         string s_BSE = "";
         string s_Formula = "";
         string s_Element = "";
-        string s_GroupId = "0";
-        string s_ListNum = "";
-        bool b_IfElementAnalysis = true;
-
+        //string s_GroupId = "0";
+        string s_OrderId = "";
+        //bool b_IfElementAnalysis = true;
+        string s_ChineseName = "";
 
         //public string STDId
         //{
@@ -45,11 +45,11 @@ namespace SpectrumSTDEditor
             get { return s_Density; }
         }
 
-        public string Electrical_conductivity
-        {
-            set { s_Electrical_conductivity = value; }
-            get { return s_Electrical_conductivity; }
-        }
+        //public string Electrical_conductivity
+        //{
+        //    set { s_Electrical_conductivity = value; }
+        //    get { return s_Electrical_conductivity; }
+        //}
         //灰度
         public string BSE
         {
@@ -81,72 +81,75 @@ namespace SpectrumSTDEditor
             get { return s_Color; }
         }
 
-        public string KeyElementList
-        {
-            set { s_KeyElementList = value; }
-            get { return s_KeyElementList; }
-        }
+        //public string KeyElementList
+        //{
+        //    set { s_KeyElementList = value; }
+        //    get { return s_KeyElementList; }
+        //}
 
-        public string SubElementList
-        {
-            set { s_SubElementList = value; }
-            get { return s_SubElementList; }
-        }
+        //public string SubElementList
+        //{
+        //    set { s_SubElementList = value; }
+        //    get { return s_SubElementList; }
+        //}
 
-        public string UsingImgPropertyList
-        {
-            set { s_UsingImgPropertyList = value; }
-            get { return s_UsingImgPropertyList; }
-        }
+        //public string UsingImgPropertyList
+        //{
+        //    set { s_UsingImgPropertyList = value; }
+        //    get { return s_UsingImgPropertyList; }
+        //}
 
-        public string UsingOtherPropertyList
-        {
-            set { s_UsingOtherPropertyList = value; }
-            get { return s_UsingOtherPropertyList; }
-        }
+        //public string UsingOtherPropertyList
+        //{
+        //    set { s_UsingOtherPropertyList = value; }
+        //    get { return s_UsingOtherPropertyList; }
+        //}
 
-        public string Expression
-        {
-            set { s_Expression = value; }
-            get { return s_Expression; }
-        }
+        //public string Expression
+        //{
+        //    set { s_Expression = value; }
+        //    get { return s_Expression; }
+        //}
 
-        public string GroupId
-        {
-            set { s_GroupId = value; }
-            get { return s_GroupId; }
-        }
+        //public string GroupId
+        //{
+        //    set { s_GroupId = value; }
+        //    get { return s_GroupId; }
+        //}
 
-        public string ListNum
+        public string OrderId
         {
-            set { s_ListNum = value; }
-            get { return s_ListNum; }
+            set { s_OrderId = value; }
+            get { return s_OrderId; }
         }
 
-        public bool IfElementAnalysis
-        {
-            set { b_IfElementAnalysis = value; }
-            get { return b_IfElementAnalysis; }
-        }
+        //public bool IfElementAnalysis
+        //{
+        //    set { b_IfElementAnalysis = value; }
+        //    get { return b_IfElementAnalysis; }
+        //}
+
+        public string ChineseName { get => s_ChineseName; set => s_ChineseName = value; }
 
         public bool Equals(STDdata a_oSource)
         {
             return (Hardness == a_oSource.Hardness) &&
               (Density == a_oSource.Density) &&
-              (Electrical_conductivity == a_oSource.Electrical_conductivity) &&
+              //(Electrical_conductivity == a_oSource.Electrical_conductivity) &&
               (BSE == a_oSource.BSE) &&
               (Formula == a_oSource.Formula) &&
               (Element == a_oSource.Element) &&
               (StrName == a_oSource.StrName) &&
               (Color == a_oSource.Color) &&
-              (KeyElementList == a_oSource.KeyElementList) &&
-              (SubElementList == a_oSource.SubElementList) &&
-              (UsingImgPropertyList == a_oSource.UsingImgPropertyList) &&
-              (UsingOtherPropertyList == a_oSource.UsingOtherPropertyList) &&
-              (Expression == a_oSource.Expression) &&
-              (GroupId == a_oSource.GroupId) &&
-              (ListNum == a_oSource.ListNum) &&
-              (IfElementAnalysis == a_oSource.IfElementAnalysis);
+              //(KeyElementList == a_oSource.KeyElementList) &&
+              //(SubElementList == a_oSource.SubElementList) &&
+              //(UsingImgPropertyList == a_oSource.UsingImgPropertyList) &&
+              //(UsingOtherPropertyList == a_oSource.UsingOtherPropertyList) &&
+              //(Expression == a_oSource.Expression) &&
+              //(GroupId == a_oSource.GroupId) &&
+              //(OrderId == a_oSource.OrderId) &&
+              //(IfElementAnalysis == a_oSource.IfElementAnalysis)
+              (ChineseName == a_oSource.ChineseName);
         }
 
         public object Clone(STDdata a_oSource)
@@ -154,20 +157,21 @@ namespace SpectrumSTDEditor
             STDdata MySTDdata = new STDdata();
             MySTDdata.Hardness = a_oSource.Hardness ;
             MySTDdata.Density = a_oSource.Density ;
-            MySTDdata.Electrical_conductivity = a_oSource.Electrical_conductivity ;
+            //MySTDdata.Electrical_conductivity = a_oSource.Electrical_conductivity ;
             MySTDdata.BSE = a_oSource.BSE ;
             MySTDdata.Formula = a_oSource.Formula ;
             MySTDdata.Element = a_oSource.Element ;
             MySTDdata.StrName = a_oSource.StrName ;
             MySTDdata.Color = a_oSource.Color ;
-            MySTDdata.KeyElementList = a_oSource.KeyElementList ;
-            MySTDdata.SubElementList = a_oSource.SubElementList ;
-            MySTDdata.UsingImgPropertyList = a_oSource.UsingImgPropertyList ;
-            MySTDdata.UsingOtherPropertyList = a_oSource.UsingOtherPropertyList ;
-            MySTDdata.Expression = a_oSource.Expression ;
-            MySTDdata.GroupId = a_oSource.GroupId ;
-            MySTDdata.ListNum = a_oSource.ListNum;
-            MySTDdata.IfElementAnalysis = a_oSource.IfElementAnalysis;
+            //MySTDdata.KeyElementList = a_oSource.KeyElementList ;
+            //MySTDdata.SubElementList = a_oSource.SubElementList ;
+            //MySTDdata.UsingImgPropertyList = a_oSource.UsingImgPropertyList ;
+            //MySTDdata.UsingOtherPropertyList = a_oSource.UsingOtherPropertyList ;
+            //MySTDdata.Expression = a_oSource.Expression ;
+            //MySTDdata.GroupId = a_oSource.GroupId ;
+            //MySTDdata.OrderId = a_oSource.OrderId;
+            //MySTDdata.IfElementAnalysis = a_oSource.IfElementAnalysis;
+            MySTDdata.ChineseName = a_oSource.ChineseName;
             return MySTDdata;
 
         }

+ 34 - 0
SpectrumSTDEditor/BaseClass/shareFunction.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Drawing;
+
+namespace SpectrumSTDEditor.BaseClass
+{
+    public static class shareFunction
+    {
+        public static string ObtainRandomColor()
+        {
+            int iSeed = 10;
+            Random ro = new Random(10);
+            long tick = DateTime.Now.Ticks;
+            Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));
+
+            int R = ran.Next(255);
+            int G = ran.Next(255);
+            int B = ran.Next(255);
+            B = (R + G > 400) ? R + G - 400 : B;//0 : 380 - R - G;
+            B = (B > 255) ? 255 : B;
+            Color color=Color.FromArgb(R, G, B);
+            return ColorTostring10(color);
+        }
+
+        public static Color string10ToColor(string lor)
+        {
+            int iColor = Convert.ToInt32(lor);
+            return Color.FromArgb(iColor % 256, (iColor >> 8) % 256, (iColor >> 16) % 256);
+        }
+        public static string ColorTostring10(Color color)
+        {
+            return (((uint)color.B << 16) | (ushort)(((ushort)color.G << 8) | color.R)).ToString();
+        }
+    }
+}

+ 2 - 2
SpectrumSTDEditor/Properties/AssemblyInfo.cs

@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
 //      生成号
 //      修订号
 //
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("3.2.0.0")]
+[assembly: AssemblyFileVersion("3.2.0.0")]

+ 57 - 10
SpectrumSTDEditor/SpectrumSTDEditor.csproj

@@ -56,29 +56,58 @@
     <Reference Include="OTS.WinFormsUI.Docking">
       <HintPath>..\..\..\OTS2_7\OTS2_0\OpenDll\WordApiDll\OTS.WinFormsUI.Docking.dll</HintPath>
     </Reference>
+    <Reference Include="OTSClrInterface, Version=0.0.0.0, Culture=neutral, processorArchitecture=AMD64">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\Bin\x64\Debug\OTSCPPDll\OTSClrInterface.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
     <Reference Include="SourceGrid">
       <HintPath>..\..\..\OTS2_7\OTS2_0\OpenDll\WordApiDll\SourceGrid.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Core">
+      <Private>False</Private>
     </Reference>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
     <Reference Include="System.Data.SQLite">
       <HintPath>..\OpenDll\SQLiteDll\System.Data.SQLite.dll</HintPath>
+      <Private>False</Private>
     </Reference>
     <Reference Include="System.Windows.Forms.Ribbon">
       <HintPath>..\..\..\OTS2_7\OTS2_0\OpenDll\WordApiDll\System.Windows.Forms.Ribbon.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Xml.Linq">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Data.DataSetExtensions">
+      <Private>False</Private>
     </Reference>
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Deployment" />
-    <Reference Include="System.Drawing" />
-    <Reference Include="System.Net.Http" />
-    <Reference Include="System.Windows.Forms" />
-    <Reference Include="System.Xml" />
+    <Reference Include="System.Data">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Deployment">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Drawing">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Net.Http">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Windows.Forms">
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="System.Xml">
+      <Private>False</Private>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="BaseClass\Language.cs" />
+    <Compile Include="BaseClass\shareFunction.cs" />
     <Compile Include="BaseClass\SqlLiteClass.cs" />
     <Compile Include="BaseClass\STDdata.cs" />
     <Compile Include="BaseClass\STDGroups.cs" />
@@ -168,6 +197,18 @@
     <Compile Include="UI\SubMidWindow.Designer.cs">
       <DependentUpon>SubMidWindow.cs</DependentUpon>
     </Compile>
+    <Compile Include="UI\UXrayControl.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="UI\UXrayControl.Designer.cs">
+      <DependentUpon>UXrayControl.cs</DependentUpon>
+    </Compile>
+    <Compile Include="UI\XrayContrastForm.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="UI\XrayContrastForm.Designer.cs">
+      <DependentUpon>XrayContrastForm.cs</DependentUpon>
+    </Compile>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -217,6 +258,12 @@
     <EmbeddedResource Include="UI\SubMidWindow.resx">
       <DependentUpon>SubMidWindow.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="UI\UXrayControl.resx">
+      <DependentUpon>UXrayControl.cs</DependentUpon>
+    </EmbeddedResource>
+    <EmbeddedResource Include="UI\XrayContrastForm.resx">
+      <DependentUpon>XrayContrastForm.cs</DependentUpon>
+    </EmbeddedResource>
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>

+ 25 - 70
SpectrumSTDEditor/UI/Attributes.cs

@@ -1,4 +1,5 @@
 using OTS.WinFormsUI.Docking;
+using SpectrumSTDEditor.BaseClass;
 using System;
 using System.Drawing;
 using System.Windows.Forms;
@@ -8,41 +9,8 @@ namespace SpectrumSTDEditor
     public partial class Attributes : DockContent
     {
         public Form_Main m_MainForm = null;
-        /// <summary>
-        /// [颜色:16进制转成RGB]
-        /// </summary>
-        /// <param name="strColor">设置16进制颜色 [返回RGB]</param>
-        /// <returns></returns>
-        public static System.Drawing.Color colorHx16toRGB(string strHxColor)
-        {
-            try
-            {
-                if (strHxColor.Length == 0)
-                {//如果为空
-                    return System.Drawing.Color.FromArgb(255, 255, 204);//设为白色
-                }
-                else
-                {//转换颜色
-                    return System.Drawing.Color.FromArgb(System.Int32.Parse(strHxColor.Substring(1, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(3, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(5, 2), System.Globalization.NumberStyles.AllowHexSpecifier));
-                }
-            }
-            catch
-            {//设为白色
-                return System.Drawing.Color.FromArgb(255, 255, 204);
-            }
-        }
-        /// <summary>
-        /// [颜色:RGB转成16进制]
-        /// </summary>
-        /// <param name="R">红 int</param>
-        /// <param name="G">绿 int</param>
-        /// <param name="B">蓝 int</param>
-        /// <returns></returns>
-        public static string colorRGBtoHx16(int R, int G, int B)
-        {
-            return System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.FromArgb(R, G, B));
-        }
 
+        
         private void clickEvent_Click(object sender, EventArgs e)
         {
             SourceGrid.CellContext context = (SourceGrid.CellContext)sender;
@@ -103,7 +71,7 @@ namespace SpectrumSTDEditor
         {
             m_MainForm.lan = new Language(this);
 
-            Grid_Attributes.Redim(13, 2);
+            Grid_Attributes.Redim(10, 2);
 
             if (m_MainForm.lan.GetNameTable("Form_Main")["language"].ToString() == "ZH")
             {
@@ -112,48 +80,42 @@ namespace SpectrumSTDEditor
                 //head1.AutomaticSortEnabled = false;
                 Grid_Attributes[1, 0] = new SourceGrid.Cells.Cell("STDId ", typeof(string));
                 Grid_Attributes[2, 0] = new SourceGrid.Cells.Cell("规则名称 ", typeof(string));
-                Grid_Attributes[3, 0] = new SourceGrid.Cells.Cell("颜色", typeof(string));
-                Grid_Attributes[4, 0] = new SourceGrid.Cells.Cell("是否元素分析 ", typeof(string));
+                Grid_Attributes[3, 0] = new SourceGrid.Cells.Cell("中文名称 ", typeof(string));
+                Grid_Attributes[4, 0] = new SourceGrid.Cells.Cell("颜色", typeof(string));
                 Grid_Attributes[5, 0] = new SourceGrid.Cells.Cell("硬度(HV)", typeof(string));
                 Grid_Attributes[6, 0] = new SourceGrid.Cells.Cell("密度(g/m³)", typeof(string));
-                Grid_Attributes[7, 0] = new SourceGrid.Cells.Cell("导电性(S/m)", typeof(string));
-                Grid_Attributes[8, 0] = new SourceGrid.Cells.Cell("Video", typeof(string));
-                Grid_Attributes[9, 0] = new SourceGrid.Cells.Cell("化学式", typeof(string));
-                Grid_Attributes[10, 0] = new SourceGrid.Cells.Cell("元素", typeof(string));
-                Grid_Attributes[11, 0] = new SourceGrid.Cells.Cell("分组名称", typeof(string));
+                Grid_Attributes[7, 0] = new SourceGrid.Cells.Cell("Video", typeof(string));
+                Grid_Attributes[8, 0] = new SourceGrid.Cells.Cell("化学式", typeof(string));
+                Grid_Attributes[9, 0] = new SourceGrid.Cells.Cell("元素", typeof(string));
             }
             else
             {
                 Grid_Attributes[0, 0] = new SourceGrid.Cells.Cell("General Properties", typeof(string));
                 Grid_Attributes[1, 0] = new SourceGrid.Cells.Cell("STDId ", typeof(string));
                 Grid_Attributes[2, 0] = new SourceGrid.Cells.Cell("RuleName ", typeof(string));
-                Grid_Attributes[3, 0] = new SourceGrid.Cells.Cell("Color", typeof(string));
-                Grid_Attributes[4, 0] = new SourceGrid.Cells.Cell("IfElementAnalysis", typeof(string));
+                Grid_Attributes[3, 0] = new SourceGrid.Cells.Cell("ChineseName ", typeof(string));
+                Grid_Attributes[4, 0] = new SourceGrid.Cells.Cell("Color", typeof(string));
                 Grid_Attributes[5, 0] = new SourceGrid.Cells.Cell("Hardness", typeof(string));
                 Grid_Attributes[6, 0] = new SourceGrid.Cells.Cell("Density", typeof(string));
-                Grid_Attributes[7, 0] = new SourceGrid.Cells.Cell("Conductivity", typeof(string));
-                Grid_Attributes[8, 0] = new SourceGrid.Cells.Cell("Video", typeof(string));
-                Grid_Attributes[9, 0] = new SourceGrid.Cells.Cell("Formula", typeof(string));
-                Grid_Attributes[10, 0] = new SourceGrid.Cells.Cell("Element", typeof(string));
-                Grid_Attributes[11, 0] = new SourceGrid.Cells.Cell("GroupName", typeof(string));
+                Grid_Attributes[7, 0] = new SourceGrid.Cells.Cell("Video", typeof(string));
+                Grid_Attributes[8, 0] = new SourceGrid.Cells.Cell("Formula", typeof(string));
+                Grid_Attributes[9, 0] = new SourceGrid.Cells.Cell("Element", typeof(string));
             }
 
             Grid_Attributes[1, 1] = new SourceGrid.Cells.Cell(" ", typeof(int));
             Grid_Attributes[2, 1] = new SourceGrid.Cells.Cell(" ", typeof(string));
             Grid_Attributes[3, 1] = new SourceGrid.Cells.Cell("", typeof(string));
-            Grid_Attributes[4, 1] = new SourceGrid.Cells.CheckBox(null, true);
+            Grid_Attributes[4, 1] = new SourceGrid.Cells.Cell("", typeof(string));
             Grid_Attributes[5, 1] = new SourceGrid.Cells.Cell("", typeof(string));
             Grid_Attributes[6, 1] = new SourceGrid.Cells.Cell("", typeof(string));
             Grid_Attributes[7, 1] = new SourceGrid.Cells.Cell("", typeof(string));
-            Grid_Attributes[8, 1] = new SourceGrid.Cells.Cell("", typeof(int));
+            Grid_Attributes[8, 1] = new SourceGrid.Cells.Cell("", typeof(string));
             Grid_Attributes[9, 1] = new SourceGrid.Cells.Cell("", typeof(string));
-            Grid_Attributes[10, 1] = new SourceGrid.Cells.Cell("", typeof(string));
-            Grid_Attributes[11, 1] = new SourceGrid.Cells.Cell("", typeof(string));
 
             Grid_Attributes[0, 0].ColumnSpan = 2;
             Grid_Attributes.AutoStretchColumnsToFitWidth = true;
-            Grid_Attributes.Columns[0].Width = 195;
-            Grid_Attributes.Columns[1].Width = 195;
+            Grid_Attributes.Columns[0].Width = this.Width / 2 - 30;
+            Grid_Attributes.Columns[1].Width = this.Width / 2 + 30;
 
             for (int i=0;i<10;i++)
             {
@@ -172,11 +134,11 @@ namespace SpectrumSTDEditor
 
             SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents();
             clickEvent.Click += new EventHandler(clickEvent_Click);
-            Grid_Attributes[3,1].AddController(clickEvent);
+            Grid_Attributes[4,1].AddController(clickEvent);
 
             Grid_Attributes[0, 1].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
             Grid_Attributes[1, 1].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
-            Grid_Attributes[3, 1].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
+            Grid_Attributes[4, 1].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
 
             Grid_Attributes[0, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
             Grid_Attributes[1, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
@@ -188,7 +150,6 @@ namespace SpectrumSTDEditor
             Grid_Attributes[7, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
             Grid_Attributes[8, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
             Grid_Attributes[9, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
-            Grid_Attributes[10, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
 
             Grid_Attributes.Selection.FocusStyle = SourceGrid.FocusStyle.None;
             //SourceGrid.Position po = new SourceGrid.Position(1, 0);
@@ -200,25 +161,19 @@ namespace SpectrumSTDEditor
         {
             Grid_Attributes[1, 1].Value = STDId;
             Grid_Attributes[2, 1].Value = m_MainForm.STDDictionary[STDId].StrName;
+            Grid_Attributes[3, 1].Value = m_MainForm.STDDictionary[STDId].ChineseName;
             SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
-            view.BackColor = colorHx16toRGB(m_MainForm.STDDictionary[STDId].Color);
-            Grid_Attributes[3, 1].View = view;
-            Grid_Attributes[4, 1].Value = Convert.ToBoolean(m_MainForm.STDDictionary[STDId].IfElementAnalysis);
+            view.BackColor = shareFunction.string10ToColor(m_MainForm.STDDictionary[STDId].Color);
+            Grid_Attributes[4, 1].View = view;
             Grid_Attributes[5, 1].Value = m_MainForm.STDDictionary[STDId].Hardness;
             Grid_Attributes[6, 1].Value = m_MainForm.STDDictionary[STDId].Density;
-            Grid_Attributes[7, 1].Value = m_MainForm.STDDictionary[STDId].Electrical_conductivity;
-
-            Grid_Attributes[8, 1].Value = int.Parse(m_MainForm.STDDictionary[STDId].BSE);
-            Grid_Attributes[9, 1].Value = m_MainForm.STDDictionary[STDId].Formula;
-            Grid_Attributes[10, 1].Value = m_MainForm.STDDictionary[STDId].Element;
-
-            //m_MainForm.AddSTDGroupsToAttribute();
-            Grid_Attributes[11, 1].Value = m_MainForm.GroupIdDictionaryFromId[int.Parse(m_MainForm.STDDictionary[STDId].GroupId)];
 
+            Grid_Attributes[7, 1].Value = m_MainForm.STDDictionary[STDId].BSE;
+            Grid_Attributes[8, 1].Value = m_MainForm.STDDictionary[STDId].Formula;
+            Grid_Attributes[9, 1].Value = m_MainForm.STDDictionary[STDId].Element;
             //SourceGrid.Position po = new SourceGrid.Position(1, 0);
             //Grid_Attributes[1, 0].Grid.Select();
             //Grid_Attributes.Selection.Focus(po, true);
-
             Grid_Attributes.Refresh();
         }
     }

+ 13 - 12
SpectrumSTDEditor/UI/Form_GroupId.cs

@@ -1,4 +1,5 @@
 using SourceGrid;
+using SpectrumSTDEditor.BaseClass;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
@@ -104,7 +105,7 @@ namespace SpectrumSTDEditor
                     SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
                     view.BackColor = cd.Color;
                     Grid_FroupId[i, 1].View = view;
-                    MineralGroupDictionary[(int)Grid_FroupId[i, 0].Tag].color = Attributes.colorRGBtoHx16(Grid_FroupId[i, 1].View.BackColor.R, Grid_FroupId[i, 1].View.BackColor.G, Grid_FroupId[i, 1].View.BackColor.B);
+                    MineralGroupDictionary[(int)Grid_FroupId[i, 0].Tag].color = shareFunction.ColorTostring10(Grid_FroupId[i, 1].View.BackColor);
                 }
             }
             Grid_FroupId.Refresh();
@@ -280,7 +281,7 @@ namespace SpectrumSTDEditor
                 Grid_FroupId[1, 0].Tag = 0;
 
                 SourceGrid.Cells.Views.Cell vw = new SourceGrid.Cells.Views.Cell();
-                vw.BackColor = Attributes.colorHx16toRGB("#C9C9C9");
+                //vw.BackColor = Attributes.colorHx16toRGB("#C9C9C9");
                 Grid_FroupId[1, 1].View = vw;
                 Grid_FroupId[1, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
                 Grid_FroupId[1, 1].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
@@ -296,7 +297,7 @@ namespace SpectrumSTDEditor
                         Grid_FroupId[i, 0].Tag = kv.Key;
 
                         SourceGrid.Cells.Views.Cell vew = new SourceGrid.Cells.Views.Cell();
-                        vew.BackColor = Attributes.colorHx16toRGB(kv.Value.color);
+                        vew.BackColor = shareFunction.string10ToColor(kv.Value.color);
                         Grid_FroupId[i, 1].View = vew;
 
                         SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents();
@@ -320,7 +321,7 @@ namespace SpectrumSTDEditor
         {
             STDGroups new_MineralGroup = new STDGroups();//定义一个TreeNode节点对象
             new_MineralGroup.name = "New Group";
-            new_MineralGroup.color = Attributes.colorRGBtoHx16(Color.Gray.R, Color.Gray.G, Color.Gray.B);
+            new_MineralGroup.color = shareFunction.ColorTostring10(Color.Gray);
             new_MineralGroup.InfoState = (int)DBInfoState.Modify;
 
             int Id = 100;
@@ -408,14 +409,14 @@ namespace SpectrumSTDEditor
             if (x > 0 && (y == 0|| y == 1))
             {
                 bool bexist = false;
-                foreach (KeyValuePair<int, STDdata> kv in m_MainForm.STDDictionary)
-                {
-                    if(kv.Value.GroupId.ToString()== Grid_FroupId[x, 0].Tag.ToString())
-                    {
-                        bexist = true;
-                        break;
-                    }
-                }
+                //foreach (KeyValuePair<int, STDdata> kv in m_MainForm.STDDictionary)
+                //{
+                //    if(kv.Value.GroupId.ToString()== Grid_FroupId[x, 0].Tag.ToString())
+                //    {
+                //        bexist = true;
+                //        break;
+                //    }
+                //}
                 if(bexist)
                 {
                     MessageBox.Show("There is a grouping in the user standard library that you want to delete!");

+ 77 - 135
SpectrumSTDEditor/UI/Form_Main.Designer.cs

@@ -28,22 +28,22 @@
         /// </summary>
         private void InitializeComponent()
         {
-            OTS.WinFormsUI.Docking.DockPanelSkin dockPanelSkin2 = new OTS.WinFormsUI.Docking.DockPanelSkin();
-            OTS.WinFormsUI.Docking.AutoHideStripSkin autoHideStripSkin2 = new OTS.WinFormsUI.Docking.AutoHideStripSkin();
-            OTS.WinFormsUI.Docking.DockPanelGradient dockPanelGradient4 = new OTS.WinFormsUI.Docking.DockPanelGradient();
-            OTS.WinFormsUI.Docking.TabGradient tabGradient8 = new OTS.WinFormsUI.Docking.TabGradient();
-            OTS.WinFormsUI.Docking.DockPaneStripSkin dockPaneStripSkin2 = new OTS.WinFormsUI.Docking.DockPaneStripSkin();
-            OTS.WinFormsUI.Docking.DockPaneStripGradient dockPaneStripGradient2 = new OTS.WinFormsUI.Docking.DockPaneStripGradient();
-            OTS.WinFormsUI.Docking.TabGradient tabGradient9 = new OTS.WinFormsUI.Docking.TabGradient();
-            OTS.WinFormsUI.Docking.DockPanelGradient dockPanelGradient5 = new OTS.WinFormsUI.Docking.DockPanelGradient();
-            OTS.WinFormsUI.Docking.TabGradient tabGradient10 = new OTS.WinFormsUI.Docking.TabGradient();
-            OTS.WinFormsUI.Docking.DockPaneStripToolWindowGradient dockPaneStripToolWindowGradient2 = new OTS.WinFormsUI.Docking.DockPaneStripToolWindowGradient();
-            OTS.WinFormsUI.Docking.TabGradient tabGradient11 = new OTS.WinFormsUI.Docking.TabGradient();
-            OTS.WinFormsUI.Docking.TabGradient tabGradient12 = new OTS.WinFormsUI.Docking.TabGradient();
-            OTS.WinFormsUI.Docking.DockPanelGradient dockPanelGradient6 = new OTS.WinFormsUI.Docking.DockPanelGradient();
-            OTS.WinFormsUI.Docking.TabGradient tabGradient13 = new OTS.WinFormsUI.Docking.TabGradient();
-            OTS.WinFormsUI.Docking.TabGradient tabGradient14 = new OTS.WinFormsUI.Docking.TabGradient();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form_Main));
+            OTS.WinFormsUI.Docking.DockPanelSkin dockPanelSkin1 = new OTS.WinFormsUI.Docking.DockPanelSkin();
+            OTS.WinFormsUI.Docking.AutoHideStripSkin autoHideStripSkin1 = new OTS.WinFormsUI.Docking.AutoHideStripSkin();
+            OTS.WinFormsUI.Docking.DockPanelGradient dockPanelGradient1 = new OTS.WinFormsUI.Docking.DockPanelGradient();
+            OTS.WinFormsUI.Docking.TabGradient tabGradient1 = new OTS.WinFormsUI.Docking.TabGradient();
+            OTS.WinFormsUI.Docking.DockPaneStripSkin dockPaneStripSkin1 = new OTS.WinFormsUI.Docking.DockPaneStripSkin();
+            OTS.WinFormsUI.Docking.DockPaneStripGradient dockPaneStripGradient1 = new OTS.WinFormsUI.Docking.DockPaneStripGradient();
+            OTS.WinFormsUI.Docking.TabGradient tabGradient2 = new OTS.WinFormsUI.Docking.TabGradient();
+            OTS.WinFormsUI.Docking.DockPanelGradient dockPanelGradient2 = new OTS.WinFormsUI.Docking.DockPanelGradient();
+            OTS.WinFormsUI.Docking.TabGradient tabGradient3 = new OTS.WinFormsUI.Docking.TabGradient();
+            OTS.WinFormsUI.Docking.DockPaneStripToolWindowGradient dockPaneStripToolWindowGradient1 = new OTS.WinFormsUI.Docking.DockPaneStripToolWindowGradient();
+            OTS.WinFormsUI.Docking.TabGradient tabGradient4 = new OTS.WinFormsUI.Docking.TabGradient();
+            OTS.WinFormsUI.Docking.TabGradient tabGradient5 = new OTS.WinFormsUI.Docking.TabGradient();
+            OTS.WinFormsUI.Docking.DockPanelGradient dockPanelGradient3 = new OTS.WinFormsUI.Docking.DockPanelGradient();
+            OTS.WinFormsUI.Docking.TabGradient tabGradient6 = new OTS.WinFormsUI.Docking.TabGradient();
+            OTS.WinFormsUI.Docking.TabGradient tabGradient7 = new OTS.WinFormsUI.Docking.TabGradient();
             this.ribbonSeparator1 = new System.Windows.Forms.RibbonSeparator();
             this.ribbonTextBox1 = new System.Windows.Forms.RibbonTextBox();
             this.ribbonTextBox2 = new System.Windows.Forms.RibbonTextBox();
@@ -53,10 +53,7 @@
             this.ribbonComboBox1 = new System.Windows.Forms.RibbonComboBox();
             this.ribbonButtonList1 = new System.Windows.Forms.RibbonButtonList();
             this.ribbon1 = new System.Windows.Forms.Ribbon();
-            this.ribbon_ESDMaxRules = new System.Windows.Forms.RibbonOrbMenuItem();
-            this.ribbon_ZeroRules = new System.Windows.Forms.RibbonOrbMenuItem();
-            this.ribbon_UserConstants = new System.Windows.Forms.RibbonOrbMenuItem();
-            this.ribbon_GroupNameMaintenance = new System.Windows.Forms.RibbonOrbMenuItem();
+            this.ribbonOrbMenuItem_Convert = new System.Windows.Forms.RibbonOrbMenuItem();
             this.ribbonSeparator3 = new System.Windows.Forms.RibbonSeparator();
             this.ribbon_Exit = new System.Windows.Forms.RibbonOrbMenuItem();
             this.ribbonTab2 = new System.Windows.Forms.RibbonTab();
@@ -175,14 +172,11 @@
             // 
             this.ribbon1.OrbDropDown.BorderRoundness = 7;
             this.ribbon1.OrbDropDown.Location = new System.Drawing.Point(0, 0);
-            this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbon_ESDMaxRules);
-            this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbon_ZeroRules);
-            this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbon_UserConstants);
-            this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbon_GroupNameMaintenance);
+            this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbonOrbMenuItem_Convert);
             this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbonSeparator3);
             this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbon_Exit);
             this.ribbon1.OrbDropDown.Name = "";
-            this.ribbon1.OrbDropDown.Size = new System.Drawing.Size(527, 295);
+            this.ribbon1.OrbDropDown.Size = new System.Drawing.Size(527, 163);
             this.ribbon1.OrbDropDown.TabIndex = 0;
             this.ribbon1.OrbImage = global::SpectrumSTDEditor.Properties.Resources.公司图标;
             // 
@@ -201,69 +195,20 @@
             this.ribbon1.TabSpacing = 6;
             this.ribbon1.Text = "ribbon1";
             // 
-            // ribbon_ESDMaxRules
-            // 
-            this.ribbon_ESDMaxRules.AltKey = null;
-            this.ribbon_ESDMaxRules.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
-            this.ribbon_ESDMaxRules.DropDownArrowSize = new System.Drawing.Size(5, 3);
-            this.ribbon_ESDMaxRules.Enabled = false;
-            this.ribbon_ESDMaxRules.Image = global::SpectrumSTDEditor.Properties.Resources.Ruler161;
-            this.ribbon_ESDMaxRules.SmallImage = global::SpectrumSTDEditor.Properties.Resources.Ruler161;
-            this.ribbon_ESDMaxRules.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
-            this.ribbon_ESDMaxRules.Tag = "ribbon_ESDMaxRules";
-            this.ribbon_ESDMaxRules.Text = "ESD Max Rules";
-            this.ribbon_ESDMaxRules.ToolTip = null;
-            this.ribbon_ESDMaxRules.ToolTipImage = null;
-            this.ribbon_ESDMaxRules.ToolTipTitle = null;
-            this.ribbon_ESDMaxRules.Click += new System.EventHandler(this.ribbon_ESDMaxRules_Click);
-            // 
-            // ribbon_ZeroRules
-            // 
-            this.ribbon_ZeroRules.AltKey = null;
-            this.ribbon_ZeroRules.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
-            this.ribbon_ZeroRules.DropDownArrowSize = new System.Drawing.Size(5, 3);
-            this.ribbon_ZeroRules.Enabled = false;
-            this.ribbon_ZeroRules.Image = global::SpectrumSTDEditor.Properties.Resources.编辑;
-            this.ribbon_ZeroRules.SmallImage = global::SpectrumSTDEditor.Properties.Resources.编辑;
-            this.ribbon_ZeroRules.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
-            this.ribbon_ZeroRules.Tag = "ribbon_ZeroRules";
-            this.ribbon_ZeroRules.Text = "Zero Rules";
-            this.ribbon_ZeroRules.ToolTip = null;
-            this.ribbon_ZeroRules.ToolTipImage = null;
-            this.ribbon_ZeroRules.ToolTipTitle = null;
-            this.ribbon_ZeroRules.Click += new System.EventHandler(this.ribbon_ZeroRules_Click);
-            // 
-            // ribbon_UserConstants
-            // 
-            this.ribbon_UserConstants.AltKey = null;
-            this.ribbon_UserConstants.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
-            this.ribbon_UserConstants.DropDownArrowSize = new System.Drawing.Size(5, 3);
-            this.ribbon_UserConstants.Enabled = false;
-            this.ribbon_UserConstants.Image = global::SpectrumSTDEditor.Properties.Resources.worddocument32;
-            this.ribbon_UserConstants.SmallImage = global::SpectrumSTDEditor.Properties.Resources.worddocument32;
-            this.ribbon_UserConstants.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
-            this.ribbon_UserConstants.Tag = "ribbon_UserConstants";
-            this.ribbon_UserConstants.Text = "常量表达式";
-            this.ribbon_UserConstants.ToolTip = null;
-            this.ribbon_UserConstants.ToolTipImage = null;
-            this.ribbon_UserConstants.ToolTipTitle = null;
-            this.ribbon_UserConstants.Click += new System.EventHandler(this.ribbon_UserConstants_Click);
-            // 
-            // ribbon_GroupNameMaintenance
-            // 
-            this.ribbon_GroupNameMaintenance.AltKey = null;
-            this.ribbon_GroupNameMaintenance.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
-            this.ribbon_GroupNameMaintenance.DropDownArrowSize = new System.Drawing.Size(5, 3);
-            this.ribbon_GroupNameMaintenance.Enabled = false;
-            this.ribbon_GroupNameMaintenance.Image = global::SpectrumSTDEditor.Properties.Resources.编辑;
-            this.ribbon_GroupNameMaintenance.SmallImage = global::SpectrumSTDEditor.Properties.Resources.编辑;
-            this.ribbon_GroupNameMaintenance.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
-            this.ribbon_GroupNameMaintenance.Tag = "ribbon_GroupNameMaintenance";
-            this.ribbon_GroupNameMaintenance.Text = "组名维护";
-            this.ribbon_GroupNameMaintenance.ToolTip = null;
-            this.ribbon_GroupNameMaintenance.ToolTipImage = null;
-            this.ribbon_GroupNameMaintenance.ToolTipTitle = null;
-            this.ribbon_GroupNameMaintenance.Click += new System.EventHandler(this.ribbon_GroupNameMaintenance_Click);
+            // ribbonOrbMenuItem_Convert
+            // 
+            this.ribbonOrbMenuItem_Convert.AltKey = null;
+            this.ribbonOrbMenuItem_Convert.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
+            this.ribbonOrbMenuItem_Convert.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.ribbonOrbMenuItem_Convert.Image = ((System.Drawing.Image)(resources.GetObject("ribbonOrbMenuItem_Convert.Image")));
+            this.ribbonOrbMenuItem_Convert.SmallImage = ((System.Drawing.Image)(resources.GetObject("ribbonOrbMenuItem_Convert.SmallImage")));
+            this.ribbonOrbMenuItem_Convert.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.ribbonOrbMenuItem_Convert.Tag = null;
+            this.ribbonOrbMenuItem_Convert.Text = "标准库转换|来自矿物库";
+            this.ribbonOrbMenuItem_Convert.ToolTip = null;
+            this.ribbonOrbMenuItem_Convert.ToolTipImage = null;
+            this.ribbonOrbMenuItem_Convert.ToolTipTitle = null;
+            this.ribbonOrbMenuItem_Convert.Click += new System.EventHandler(this.ribbonOrbMenuItem_Convert_Click);
             // 
             // ribbonSeparator3
             // 
@@ -424,50 +369,50 @@
             this.dockPanel1.Location = new System.Drawing.Point(0, 130);
             this.dockPanel1.Name = "dockPanel1";
             this.dockPanel1.Size = new System.Drawing.Size(1805, 660);
-            dockPanelGradient4.EndColor = System.Drawing.SystemColors.ControlLight;
-            dockPanelGradient4.StartColor = System.Drawing.SystemColors.ControlLight;
-            autoHideStripSkin2.DockStripGradient = dockPanelGradient4;
-            tabGradient8.EndColor = System.Drawing.SystemColors.Control;
-            tabGradient8.StartColor = System.Drawing.SystemColors.Control;
-            tabGradient8.TextColor = System.Drawing.SystemColors.ControlDarkDark;
-            autoHideStripSkin2.TabGradient = tabGradient8;
-            dockPanelSkin2.AutoHideStripSkin = autoHideStripSkin2;
-            tabGradient9.EndColor = System.Drawing.SystemColors.ControlLightLight;
-            tabGradient9.StartColor = System.Drawing.SystemColors.ControlLightLight;
-            tabGradient9.TextColor = System.Drawing.SystemColors.ControlText;
-            dockPaneStripGradient2.ActiveTabGradient = tabGradient9;
-            dockPanelGradient5.EndColor = System.Drawing.SystemColors.Control;
-            dockPanelGradient5.StartColor = System.Drawing.SystemColors.Control;
-            dockPaneStripGradient2.DockStripGradient = dockPanelGradient5;
-            tabGradient10.EndColor = System.Drawing.SystemColors.ControlLight;
-            tabGradient10.StartColor = System.Drawing.SystemColors.ControlLight;
-            tabGradient10.TextColor = System.Drawing.SystemColors.ControlText;
-            dockPaneStripGradient2.InactiveTabGradient = tabGradient10;
-            dockPaneStripSkin2.DocumentGradient = dockPaneStripGradient2;
-            tabGradient11.EndColor = System.Drawing.SystemColors.ActiveCaption;
-            tabGradient11.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
-            tabGradient11.StartColor = System.Drawing.SystemColors.GradientActiveCaption;
-            tabGradient11.TextColor = System.Drawing.SystemColors.ActiveCaptionText;
-            dockPaneStripToolWindowGradient2.ActiveCaptionGradient = tabGradient11;
-            tabGradient12.EndColor = System.Drawing.SystemColors.Control;
-            tabGradient12.StartColor = System.Drawing.SystemColors.Control;
-            tabGradient12.TextColor = System.Drawing.SystemColors.ControlText;
-            dockPaneStripToolWindowGradient2.ActiveTabGradient = tabGradient12;
-            dockPanelGradient6.EndColor = System.Drawing.SystemColors.ControlLight;
-            dockPanelGradient6.StartColor = System.Drawing.SystemColors.ControlLight;
-            dockPaneStripToolWindowGradient2.DockStripGradient = dockPanelGradient6;
-            tabGradient13.EndColor = System.Drawing.SystemColors.GradientInactiveCaption;
-            tabGradient13.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
-            tabGradient13.StartColor = System.Drawing.SystemColors.GradientInactiveCaption;
-            tabGradient13.TextColor = System.Drawing.SystemColors.ControlText;
-            dockPaneStripToolWindowGradient2.InactiveCaptionGradient = tabGradient13;
-            tabGradient14.EndColor = System.Drawing.Color.Transparent;
-            tabGradient14.StartColor = System.Drawing.Color.Transparent;
-            tabGradient14.TextColor = System.Drawing.SystemColors.ControlDarkDark;
-            dockPaneStripToolWindowGradient2.InactiveTabGradient = tabGradient14;
-            dockPaneStripSkin2.ToolWindowGradient = dockPaneStripToolWindowGradient2;
-            dockPanelSkin2.DockPaneStripSkin = dockPaneStripSkin2;
-            this.dockPanel1.Skin = dockPanelSkin2;
+            dockPanelGradient1.EndColor = System.Drawing.SystemColors.ControlLight;
+            dockPanelGradient1.StartColor = System.Drawing.SystemColors.ControlLight;
+            autoHideStripSkin1.DockStripGradient = dockPanelGradient1;
+            tabGradient1.EndColor = System.Drawing.SystemColors.Control;
+            tabGradient1.StartColor = System.Drawing.SystemColors.Control;
+            tabGradient1.TextColor = System.Drawing.SystemColors.ControlDarkDark;
+            autoHideStripSkin1.TabGradient = tabGradient1;
+            dockPanelSkin1.AutoHideStripSkin = autoHideStripSkin1;
+            tabGradient2.EndColor = System.Drawing.SystemColors.ControlLightLight;
+            tabGradient2.StartColor = System.Drawing.SystemColors.ControlLightLight;
+            tabGradient2.TextColor = System.Drawing.SystemColors.ControlText;
+            dockPaneStripGradient1.ActiveTabGradient = tabGradient2;
+            dockPanelGradient2.EndColor = System.Drawing.SystemColors.Control;
+            dockPanelGradient2.StartColor = System.Drawing.SystemColors.Control;
+            dockPaneStripGradient1.DockStripGradient = dockPanelGradient2;
+            tabGradient3.EndColor = System.Drawing.SystemColors.ControlLight;
+            tabGradient3.StartColor = System.Drawing.SystemColors.ControlLight;
+            tabGradient3.TextColor = System.Drawing.SystemColors.ControlText;
+            dockPaneStripGradient1.InactiveTabGradient = tabGradient3;
+            dockPaneStripSkin1.DocumentGradient = dockPaneStripGradient1;
+            tabGradient4.EndColor = System.Drawing.SystemColors.ActiveCaption;
+            tabGradient4.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
+            tabGradient4.StartColor = System.Drawing.SystemColors.GradientActiveCaption;
+            tabGradient4.TextColor = System.Drawing.SystemColors.ActiveCaptionText;
+            dockPaneStripToolWindowGradient1.ActiveCaptionGradient = tabGradient4;
+            tabGradient5.EndColor = System.Drawing.SystemColors.Control;
+            tabGradient5.StartColor = System.Drawing.SystemColors.Control;
+            tabGradient5.TextColor = System.Drawing.SystemColors.ControlText;
+            dockPaneStripToolWindowGradient1.ActiveTabGradient = tabGradient5;
+            dockPanelGradient3.EndColor = System.Drawing.SystemColors.ControlLight;
+            dockPanelGradient3.StartColor = System.Drawing.SystemColors.ControlLight;
+            dockPaneStripToolWindowGradient1.DockStripGradient = dockPanelGradient3;
+            tabGradient6.EndColor = System.Drawing.SystemColors.GradientInactiveCaption;
+            tabGradient6.LinearGradientMode = System.Drawing.Drawing2D.LinearGradientMode.Vertical;
+            tabGradient6.StartColor = System.Drawing.SystemColors.GradientInactiveCaption;
+            tabGradient6.TextColor = System.Drawing.SystemColors.ControlText;
+            dockPaneStripToolWindowGradient1.InactiveCaptionGradient = tabGradient6;
+            tabGradient7.EndColor = System.Drawing.Color.Transparent;
+            tabGradient7.StartColor = System.Drawing.Color.Transparent;
+            tabGradient7.TextColor = System.Drawing.SystemColors.ControlDarkDark;
+            dockPaneStripToolWindowGradient1.InactiveTabGradient = tabGradient7;
+            dockPaneStripSkin1.ToolWindowGradient = dockPaneStripToolWindowGradient1;
+            dockPanelSkin1.DockPaneStripSkin = dockPaneStripSkin1;
+            this.dockPanel1.Skin = dockPanelSkin1;
             this.dockPanel1.TabIndex = 31;
             // 
             // ribbonOrbRecentItem1
@@ -644,8 +589,6 @@
         private System.Windows.Forms.RibbonButton ribbonButton2;
         private System.Windows.Forms.RibbonButton ribbonButton3;
         private System.Windows.Forms.RibbonPanel ribbonPanel4;
-        private System.Windows.Forms.RibbonOrbMenuItem ribbon_ESDMaxRules;
-        private System.Windows.Forms.RibbonOrbMenuItem ribbon_ZeroRules;
         public System.Windows.Forms.RibbonButton rbOpen;
         public System.Windows.Forms.RibbonButton rbClose;
         public System.Windows.Forms.RibbonButton rbBackup;
@@ -653,9 +596,8 @@
         public System.Windows.Forms.RibbonButton rbSave;
         private System.Windows.Forms.RibbonTextBox ribbonTextBox3;
         public OTS.WinFormsUI.Docking.DockPanel dockPanel1;
-        private System.Windows.Forms.RibbonOrbMenuItem ribbon_UserConstants;
-        private System.Windows.Forms.RibbonOrbMenuItem ribbon_GroupNameMaintenance;
         private System.Windows.Forms.RibbonSeparator ribbonSeparator3;
         private System.Windows.Forms.RibbonOrbMenuItem ribbon_Exit;
+        private System.Windows.Forms.RibbonOrbMenuItem ribbonOrbMenuItem_Convert;
     }
 }

File diff suppressed because it is too large
+ 162 - 614
SpectrumSTDEditor/UI/Form_Main.cs


+ 30 - 18
SpectrumSTDEditor/UI/Form_Main.resx

@@ -118,112 +118,124 @@
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="ribbonOrbMenuItem_Convert.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wQAADsEBuJFr7QAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="ribbonOrbMenuItem_Convert.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wQAADsEBuJFr7QAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+</value>
+  </data>
   <data name="ribbonOrbRecentItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
 </value>
   </data>
   <data name="ribbonOrbRecentItem1.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonOrbOptionButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
 </value>
   </data>
   <data name="ribbonOrbOptionButton1.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonOrbMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
 </value>
   </data>
   <data name="ribbonOrbMenuItem1.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonDescriptionMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
 </value>
   </data>
   <data name="ribbonDescriptionMenuItem1.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonColorChooser1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
 </value>
   </data>
   <data name="ribbonColorChooser1.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonOrbMenuItem2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
 </value>
   </data>
   <data name="ribbonOrbMenuItem2.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
 </value>
   </data>
   <data name="ribbonButton1.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonButton2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
 </value>
   </data>
   <data name="ribbonButton2.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonButton3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
 </value>
   </data>
   <data name="ribbonButton3.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
 </root>

+ 32 - 92
SpectrumSTDEditor/UI/ReferenceLibrary.cs

@@ -1,12 +1,8 @@
 using OTS.WinFormsUI.Docking;
+using SpectrumSTDEditor.BaseClass;
 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.Windows.Forms;
 
 namespace SpectrumSTDEditor
@@ -29,20 +25,18 @@ namespace SpectrumSTDEditor
             int iColumnWidth = 20;    // 第一列的宽度
             int width = this.Width;
 
-            PropGrid.Redim(1, 12);
+            PropGrid.Redim(1, 10);
             PropGrid.Columns.SetWidth(0, iColumnWidth);
             PropGrid.Columns.AutoSizeColumn(2);    // 固定进度条
 
             PropGrid.Columns.SetWidth(2, 1 * (width - iColumnWidth) / 30);
-            PropGrid.Columns.SetWidth(3, 25 * (width - iColumnWidth) / 30);
-            PropGrid.Columns.SetWidth(4, 3 * (width - iColumnWidth) / 30);
+            PropGrid.Columns.SetWidth(3, 1 * (width - iColumnWidth) / 30);
+            PropGrid.Columns.SetWidth(4, 25 * (width - iColumnWidth) / 30);
             PropGrid.Columns.SetWidth(5, 1 * (width - iColumnWidth) / 30);
             PropGrid.Columns.SetWidth(6, 1 * (width - iColumnWidth) / 30);
             PropGrid.Columns.SetWidth(7, 2 * (width - iColumnWidth) / 30);
-            PropGrid.Columns.SetWidth(8, 1 * (width - iColumnWidth) / 30);
-            PropGrid.Columns.SetWidth(9, 3 * (width - iColumnWidth) / 30);
-            PropGrid.Columns.SetWidth(10, 10 * (width - iColumnWidth) / 30);
-            PropGrid.Columns.SetWidth(11, 1 * (width - iColumnWidth) / 30);
+            PropGrid.Columns.SetWidth(8, 3 * (width - iColumnWidth) / 30);
+            PropGrid.Columns.SetWidth(9, 5 * (width - iColumnWidth) / 30);
             PropGrid.AutoStretchColumnsToFitWidth = true;
 
             // 创建列标题
@@ -53,30 +47,24 @@ namespace SpectrumSTDEditor
                 if (m_SubMidWindow.m_MainForm.lan.GetNameTable("Form_Main")["language"].ToString() == "ZH")
                 {
                     listColName.Add("规则名称");
+                    listColName.Add("中文名");
                     listColName.Add("颜色");
-                    listColName.Add("表达式");
-                    listColName.Add("必须存在元素");
                     listColName.Add("硬度");
                     listColName.Add("密度");
-                    listColName.Add("导电性");
                     listColName.Add("BSE");
                     listColName.Add("化学式");
                     listColName.Add("元素");
-                    listColName.Add("分组名称");
                 }
                 else
                 {
                     listColName.Add("Rule Name");
+                    listColName.Add("ChineseName");
                     listColName.Add("Color");
-                    listColName.Add("Expression");
-                    listColName.Add("Elements must exist");
                     listColName.Add("Hardness");
                     listColName.Add("Density");
-                    listColName.Add("Conductivity");
                     listColName.Add("BSE");
                     listColName.Add("Formula");
                     listColName.Add("Element");
-                    listColName.Add("GroupName");
                 }
                 for (int i = 0; i < listColName.Count; i++)
                 {
@@ -109,7 +97,7 @@ namespace SpectrumSTDEditor
                 System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + DBAddress + "'");
                 m_dbConnection.Open();
                 //加载STD信息
-                System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from ClassifySTD", m_dbConnection);
+                System.Data.SQLite.SQLiteDataAdapter m_dataAdapter = new System.Data.SQLite.SQLiteDataAdapter("select * from STDMinerals", m_dbConnection);
                 DataSet ds = new DataSet();
                 m_dataAdapter.Fill(ds);
                 DataTable dt = ds.Tables[0];
@@ -123,43 +111,18 @@ namespace SpectrumSTDEditor
                         {
                             STDdata new_STDdata = new STDdata();
 
-                            new_STDdata.Hardness = item["Hardness"].ToString();
-                            new_STDdata.Density = item["Density"].ToString();
-                            new_STDdata.Electrical_conductivity = item["Electrical_conductivity"].ToString();
-                            new_STDdata.BSE = item["BSE"].ToString();
-                            new_STDdata.Formula = item["Formula"].ToString();
-                            new_STDdata.Element = item["Formula"].ToString();
-                            new_STDdata.StrName = item["StrName"].ToString();
-                            new_STDdata.Expression = item["Expression"].ToString();
-                            new_STDdata.Color = item["Color"].ToString();
-                            new_STDdata.KeyElementList = item["KeyElementList"].ToString();
-                            new_STDdata.SubElementList = item["SubElementList"].ToString();
-                            new_STDdata.GroupId = item["GroupId"].ToString();
-
-                            STDDictionary.Add(int.Parse(item["STDId"].ToString()), new_STDdata);
+                            new_STDdata.Hardness = item["rigiditymod"].ToString();
+                            new_STDdata.Density = item["density"].ToString();
+                            new_STDdata.BSE = item["BSEValue"].ToString();
+                            new_STDdata.Formula = item["formula"].ToString();
+                            new_STDdata.Element = item["element"].ToString();
+                            new_STDdata.StrName = item["name"].ToString();
+                            new_STDdata.Color = item["color"].ToString();
+                            new_STDdata.ChineseName = item["chinesename"].ToString();
+                            STDDictionary.Add(int.Parse(item["id"].ToString()), new_STDdata);
                         }
                     }
                 }
-
-                System.Data.SQLite.SQLiteDataAdapter m_dataAdapterGroup = new System.Data.SQLite.SQLiteDataAdapter("select Id,name from STDGroups", m_dbConnection);
-                DataSet dsGroup = new DataSet();
-                m_dataAdapterGroup.Fill(dsGroup);
-                DataTable dtGroup = dsGroup.Tables[0];
-                if (dtGroup != null)
-                {
-                    if (dtGroup.Rows.Count >= 0)
-                    {
-                        foreach (DataRow item in dtGroup.Rows)
-                        {
-                            ReferenceGroup.Add(int.Parse(item["Id"].ToString()), item["name"].ToString());
-                        }
-                        if(!ReferenceGroup.Keys.Contains(0))
-                        {
-                            ReferenceGroup.Add(0, "Default");
-                        }
-                    }
-                }
-
                 return true;
             }
             catch (Exception)
@@ -170,9 +133,10 @@ namespace SpectrumSTDEditor
             }
         }
 
+
         void AddDataToRefereceLiberary(Dictionary<int, STDdata> RefDictionary)
         {
-            PropGrid.Redim(RefDictionary.Count+1, 12);
+            PropGrid.Redim(RefDictionary.Count+1, 9);
 
             int i = 1;
             foreach (KeyValuePair<int, STDdata> kv in RefDictionary)
@@ -194,21 +158,18 @@ namespace SpectrumSTDEditor
 
                 PropGrid[i, 1] = new SourceGrid.Cells.Cell(kv.Value.StrName, typeof(string));
                 PropGrid[i, 1].Tag = kv.Key;
+                PropGrid[i, 2] = new SourceGrid.Cells.Cell(kv.Value.ChineseName, typeof(string));
 
-                PropGrid[i, 2] = new SourceGrid.Cells.Cell("", typeof(string));
+                PropGrid[i, 3] = new SourceGrid.Cells.Cell("", typeof(string));
 
                 SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
-                view.BackColor = STDRuleslist.colorHx16toRGB(kv.Value.Color);
-                PropGrid[i, 2].View = view;
-                PropGrid[i, 3] = new SourceGrid.Cells.Cell(kv.Value.Expression, typeof(string));
-                PropGrid[i, 4] = new SourceGrid.Cells.Cell(kv.Value.KeyElementList, typeof(string));
-                PropGrid[i, 5] = new SourceGrid.Cells.Cell(kv.Value.Hardness, typeof(string));
-                PropGrid[i, 6] = new SourceGrid.Cells.Cell(kv.Value.Density, typeof(string));
-                PropGrid[i, 7] = new SourceGrid.Cells.Cell(kv.Value.Electrical_conductivity, typeof(string));
-                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));
+                view.BackColor = shareFunction.string10ToColor(kv.Value.Color);
+                PropGrid[i, 3].View = view;
+                PropGrid[i, 4] = new SourceGrid.Cells.Cell(kv.Value.Hardness, typeof(string));
+                PropGrid[i, 5] = new SourceGrid.Cells.Cell(kv.Value.Density, typeof(string));
+                PropGrid[i, 6] = new SourceGrid.Cells.Cell(kv.Value.BSE, typeof(string));
+                PropGrid[i, 7] = new SourceGrid.Cells.Cell(kv.Value.Formula, typeof(string));
+                PropGrid[i, 8] = new SourceGrid.Cells.Cell(kv.Value.Element, typeof(string));
                 i++;
             }
 
@@ -216,7 +177,7 @@ namespace SpectrumSTDEditor
             int iColumnWidth = 45;    // 第一列的宽度
             int width = this.Width;
             PropGrid.Columns.SetWidth(0, iColumnWidth);
-            PropGrid.Columns.SetWidth(2, 1 * (width - iColumnWidth) / 20);
+            PropGrid.Columns.SetWidth(3, 1 * (width - iColumnWidth) / 20);
             //PropGrid.Columns.SetWidth(3, 25 * (width - iColumnWidth) / 30);
             //PropGrid.Columns.SetWidth(4, 3 * (width - iColumnWidth) / 30);
             //PropGrid.Columns.SetWidth(5, 1 * (width - iColumnWidth) / 30);
@@ -376,19 +337,12 @@ namespace SpectrumSTDEditor
                             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.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.InsertNewRow(STDId + 1, sT.StrName, shareFunction.string10ToColor(sT.Color));
                             m_SubMidWindow.m_MainForm.m_STDRuleslist.Refresh();
 
                             m_SubMidWindow.m_MainForm.m_STDRuleslist.PreRow = i;
@@ -460,25 +414,11 @@ namespace SpectrumSTDEditor
             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;
-            if (m_SubMidWindow.m_MainForm.GroupIdDictionaryFromId.ContainsKey(int.Parse(ReferenceDictionary[STDnum].GroupId)))
-            { sT.GroupId = ReferenceDictionary[STDnum].GroupId; }
-            else
-            {
-                MessageBox.Show("As this classification group is not defined, it has been adjusted to the default grouping!");
-            }
 
             m_SubMidWindow.m_MainForm.STDDictionary.Add(STDId + 1, sT);
-
-            m_SubMidWindow.m_MainForm.m_STDRuleslist.AddNewRow(STDId + 1, sT.StrName, STDRuleslist.colorHx16toRGB(sT.Color));
+            m_SubMidWindow.m_MainForm.m_STDRuleslist.AddNewRow(STDId + 1, sT.StrName, shareFunction.string10ToColor(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;
         }

+ 68 - 61
SpectrumSTDEditor/UI/STDEditor.Designer.cs

@@ -29,15 +29,15 @@
         private void InitializeComponent()
         {
             this.tabXray = new System.Windows.Forms.TabPage();
-            this.plXray = new System.Windows.Forms.Panel();
             this.panel1 = new System.Windows.Forms.Panel();
-            this.label2 = new System.Windows.Forms.Label();
-            this.btnCollectXray = new System.Windows.Forms.Button();
-            this.btnReadXray = new System.Windows.Forms.Button();
-            this.txtCollectTime = new System.Windows.Forms.TextBox();
-            this.label9 = new System.Windows.Forms.Label();
-            this.btnTest = new System.Windows.Forms.Button();
             this.button_ImportFromResult = new System.Windows.Forms.Button();
+            this.btnTest = new System.Windows.Forms.Button();
+            this.label9 = new System.Windows.Forms.Label();
+            this.txtCollectTime = new System.Windows.Forms.TextBox();
+            this.btnReadXray = new System.Windows.Forms.Button();
+            this.btnCollectXray = new System.Windows.Forms.Button();
+            this.label2 = new System.Windows.Forms.Label();
+            this.plXray = new System.Windows.Forms.Panel();
             this.tabSTDStandrad = new System.Windows.Forms.TabControl();
             this.tabXray.SuspendLayout();
             this.panel1.SuspendLayout();
@@ -56,13 +56,6 @@
             this.tabXray.Text = "Xray";
             this.tabXray.UseVisualStyleBackColor = true;
             // 
-            // plXray
-            // 
-            this.plXray.Location = new System.Drawing.Point(3, 43);
-            this.plXray.Name = "plXray";
-            this.plXray.Size = new System.Drawing.Size(1246, 381);
-            this.plXray.TabIndex = 16;
-            // 
             // panel1
             // 
             this.panel1.Controls.Add(this.button_ImportFromResult);
@@ -76,36 +69,38 @@
             this.panel1.Name = "panel1";
             this.panel1.Size = new System.Drawing.Size(1246, 37);
             this.panel1.TabIndex = 17;
+            this.panel1.Visible = false;
             // 
-            // label2
+            // button_ImportFromResult
             // 
-            this.label2.AutoSize = true;
-            this.label2.Font = new System.Drawing.Font("宋体", 9F);
-            this.label2.Location = new System.Drawing.Point(3, 12);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(83, 12);
-            this.label2.TabIndex = 29;
-            this.label2.Text = "Collect Time:";
+            this.button_ImportFromResult.Location = new System.Drawing.Point(403, 5);
+            this.button_ImportFromResult.Name = "button_ImportFromResult";
+            this.button_ImportFromResult.Size = new System.Drawing.Size(111, 23);
+            this.button_ImportFromResult.TabIndex = 34;
+            this.button_ImportFromResult.Text = "从结果中导入";
+            this.button_ImportFromResult.UseVisualStyleBackColor = true;
+            this.button_ImportFromResult.Visible = false;
             // 
-            // btnCollectXray
+            // btnTest
             // 
-            this.btnCollectXray.Location = new System.Drawing.Point(164, 7);
-            this.btnCollectXray.Name = "btnCollectXray";
-            this.btnCollectXray.Size = new System.Drawing.Size(68, 23);
-            this.btnCollectXray.TabIndex = 30;
-            this.btnCollectXray.TabStop = false;
-            this.btnCollectXray.Text = "Collect";
-            this.btnCollectXray.UseVisualStyleBackColor = true;
+            this.btnTest.Location = new System.Drawing.Point(536, 5);
+            this.btnTest.Name = "btnTest";
+            this.btnTest.Size = new System.Drawing.Size(75, 23);
+            this.btnTest.TabIndex = 33;
+            this.btnTest.Text = "Test";
+            this.btnTest.UseVisualStyleBackColor = true;
+            this.btnTest.Visible = false;
             // 
-            // btnReadXray
+            // label9
             // 
-            this.btnReadXray.Location = new System.Drawing.Point(238, 6);
-            this.btnReadXray.Name = "btnReadXray";
-            this.btnReadXray.Size = new System.Drawing.Size(145, 23);
-            this.btnReadXray.TabIndex = 31;
-            this.btnReadXray.TabStop = false;
-            this.btnReadXray.Text = "ImportXrayFile";
-            this.btnReadXray.UseVisualStyleBackColor = true;
+            this.label9.AutoSize = true;
+            this.label9.Font = new System.Drawing.Font("宋体", 9F);
+            this.label9.Location = new System.Drawing.Point(145, 13);
+            this.label9.Name = "label9";
+            this.label9.Size = new System.Drawing.Size(17, 12);
+            this.label9.TabIndex = 32;
+            this.label9.Text = "MS";
+            this.label9.Visible = false;
             // 
             // txtCollectTime
             // 
@@ -115,35 +110,47 @@
             this.txtCollectTime.TabIndex = 28;
             this.txtCollectTime.Text = "120";
             this.txtCollectTime.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            this.txtCollectTime.Visible = false;
             // 
-            // label9
+            // btnReadXray
             // 
-            this.label9.AutoSize = true;
-            this.label9.Font = new System.Drawing.Font("宋体", 9F);
-            this.label9.Location = new System.Drawing.Point(145, 13);
-            this.label9.Name = "label9";
-            this.label9.Size = new System.Drawing.Size(17, 12);
-            this.label9.TabIndex = 32;
-            this.label9.Text = "MS";
+            this.btnReadXray.Location = new System.Drawing.Point(238, 6);
+            this.btnReadXray.Name = "btnReadXray";
+            this.btnReadXray.Size = new System.Drawing.Size(145, 23);
+            this.btnReadXray.TabIndex = 31;
+            this.btnReadXray.TabStop = false;
+            this.btnReadXray.Text = "ImportXrayFile";
+            this.btnReadXray.UseVisualStyleBackColor = true;
+            this.btnReadXray.Visible = false;
             // 
-            // btnTest
+            // btnCollectXray
             // 
-            this.btnTest.Location = new System.Drawing.Point(536, 5);
-            this.btnTest.Name = "btnTest";
-            this.btnTest.Size = new System.Drawing.Size(75, 23);
-            this.btnTest.TabIndex = 33;
-            this.btnTest.Text = "Test";
-            this.btnTest.UseVisualStyleBackColor = true;
-            this.btnTest.Visible = false;
+            this.btnCollectXray.Location = new System.Drawing.Point(164, 7);
+            this.btnCollectXray.Name = "btnCollectXray";
+            this.btnCollectXray.Size = new System.Drawing.Size(68, 23);
+            this.btnCollectXray.TabIndex = 30;
+            this.btnCollectXray.TabStop = false;
+            this.btnCollectXray.Text = "Collect";
+            this.btnCollectXray.UseVisualStyleBackColor = true;
+            this.btnCollectXray.Visible = false;
             // 
-            // button_ImportFromResult
+            // label2
             // 
-            this.button_ImportFromResult.Location = new System.Drawing.Point(403, 5);
-            this.button_ImportFromResult.Name = "button_ImportFromResult";
-            this.button_ImportFromResult.Size = new System.Drawing.Size(111, 23);
-            this.button_ImportFromResult.TabIndex = 34;
-            this.button_ImportFromResult.Text = "从结果中导入";
-            this.button_ImportFromResult.UseVisualStyleBackColor = true;
+            this.label2.AutoSize = true;
+            this.label2.Font = new System.Drawing.Font("宋体", 9F);
+            this.label2.Location = new System.Drawing.Point(3, 12);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(83, 12);
+            this.label2.TabIndex = 29;
+            this.label2.Text = "Collect Time:";
+            this.label2.Visible = false;
+            // 
+            // plXray
+            // 
+            this.plXray.Location = new System.Drawing.Point(3, 0);
+            this.plXray.Name = "plXray";
+            this.plXray.Size = new System.Drawing.Size(1246, 424);
+            this.plXray.TabIndex = 16;
             // 
             // tabSTDStandrad
             // 

+ 15 - 73
SpectrumSTDEditor/UI/STDEditor.cs

@@ -6,6 +6,10 @@ using System.Linq;
 using System.Windows.Forms;
 using System.Collections;
 using System.Text.RegularExpressions;
+using System.Text;
+using System.IO;
+using System.Data;
+using OTSCLRINTERFACE;
 
 namespace SpectrumSTDEditor
 {
@@ -44,6 +48,7 @@ namespace SpectrumSTDEditor
 
             X = this.Width;
             Y = this.Height;
+            XrayControl=new UXrayControl();
             setTag(this);
         }
         public STDEditor(SubMidWindow SubMidWindow, string STDDBaddress)
@@ -68,29 +73,6 @@ namespace SpectrumSTDEditor
             m_STDXrayList = new List<STDXray>();
             BindSTDXray(); 
         }
-        /// <summary>
-        /// [颜色:16进制转成RGB]
-        /// </summary>
-        /// <param name="strColor">设置16进制颜色 [返回RGB]</param>
-        /// <returns></returns>
-        public static System.Drawing.Color colorHx16toRGB(string strHxColor)
-        {
-            try
-            {
-                if (strHxColor.Length == 0)
-                {//如果为空
-                    return System.Drawing.Color.FromArgb(255, 255, 204);//设为白色
-                }
-                else
-                {//转换颜色
-                    return System.Drawing.Color.FromArgb(System.Int32.Parse(strHxColor.Substring(1, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(3, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(5, 2), System.Globalization.NumberStyles.AllowHexSpecifier));
-                }
-            }
-            catch
-            {//设为白色
-                return System.Drawing.Color.FromArgb(255, 255, 204);
-            }
-        }
 
         float AmplificationFactor = 1;
         //private void button_Extend_Click(object sender, EventArgs e)
@@ -135,7 +117,7 @@ namespace SpectrumSTDEditor
             }
             //显示Xray
             xrayByteData = IntArrToByteArr(GetCollectXray(strTime));
-            int color = Convert.ToInt32(ParseRGB(colorHx16toRGB(m_SubMidWindow.m_MainForm.STDDictionary[STDId].Color)).ToString());
+            int color = Convert.ToInt32(m_SubMidWindow.m_MainForm.STDDictionary[STDId].Color);
             //根据树节点修改对应的Xray信息
             UpdateSTDXray(STDId, xrayByteData);
             ShowXrayAtlas(color, xrayByteData);
@@ -150,7 +132,7 @@ namespace SpectrumSTDEditor
             {
                 if (null == m_cfun)
                 {
-                    m_cfun = COTSControlFunExport.GetControllerInstance();
+                    //m_cfun = COTSControlFunExport.GetControllerInstance();
                 }
                 if (ConnectionSem(connectionEnumType.EDSOnlyPointXRay))
                 {
@@ -207,7 +189,7 @@ namespace SpectrumSTDEditor
                     }
                     //Xray数据
                     xrayByteData = IntArrToByteArr(data);
-                    int color = Convert.ToInt32(ParseRGB(colorHx16toRGB(m_SubMidWindow.m_MainForm.STDDictionary[STDId].Color)).ToString());
+                    int color = Convert.ToInt32(m_SubMidWindow.m_MainForm.STDDictionary[STDId].Color);
                     //根据树节点修改对应的Xray信息
                     UpdateSTDXray(STDId, xrayByteData);
                     ShowXrayAtlas(color, xrayByteData);
@@ -631,7 +613,7 @@ namespace SpectrumSTDEditor
                         //修改XrayData信息
                         if (item.StdID == Key.ToString())
                         {
-                            string selColor = ParseRGB(colorHx16toRGB(sT.Color)).ToString();
+                            string selColor = sT.Color;
                             int colorValue = Convert.ToInt32(selColor);
                             //显示Xray信息
                             if (item.XrayData != null)
@@ -790,55 +772,15 @@ namespace SpectrumSTDEditor
             xrayContrastForm.STDDictionary = m_SubMidWindow.m_MainForm.STDDictionary;
             xrayContrastForm.ShowDialog();
         }
-
-        string ElementKeyOrSub = "";
-
-        private void dataGridView_KeyElements_CellClick(object sender, DataGridViewCellEventArgs e)
-        {
-            ElementKeyOrSub = dataGridView_KeyElements.CurrentCell.Value.ToString();
-            dataGridView_KeyElements.Columns.RemoveAt(e.ColumnIndex);
-
-            DataGridViewButtonColumn dataGridViewButtonColumn = new DataGridViewButtonColumn();
-            dataGridViewButtonColumn.Name = dataGridView_SubElements.Columns.Count.ToString();
-            dataGridView_SubElements.Columns.Add(dataGridViewButtonColumn);
-            if (dataGridView_SubElements.Rows.Count == 0)
-            {
-                DataGridViewRow row = new DataGridViewRow();
-                dataGridView_SubElements.Rows.Add(row);
-            }
-            dataGridView_SubElements.Rows[0].Cells[dataGridView_SubElements.Columns.Count - 1].Value = ElementKeyOrSub;
-            dataGridView_SubElements.ClearSelection();
-            dataGridView_KeyElements.ClearSelection();
-        }
-
-        private void dataGridView_SubElements_CellClick(object sender, DataGridViewCellEventArgs e)
-        {
-            ElementKeyOrSub = dataGridView_SubElements.CurrentCell.Value.ToString();
-            dataGridView_SubElements.Columns.RemoveAt(e.ColumnIndex);
-
-            DataGridViewButtonColumn dataGridViewButtonColumn = new DataGridViewButtonColumn();
-            dataGridViewButtonColumn.Name = dataGridView_SubElements.Columns.Count.ToString();
-            dataGridView_KeyElements.Columns.Add(dataGridViewButtonColumn);
-            if (dataGridView_KeyElements.Rows.Count == 0)
-            {
-                DataGridViewRow row = new DataGridViewRow();
-                dataGridView_KeyElements.Rows.Add(row);
-            }
-            dataGridView_KeyElements.Rows[0].Cells[dataGridView_KeyElements.Columns.Count - 1].Value = ElementKeyOrSub;
-            dataGridView_KeyElements.ClearSelection();
-            dataGridView_SubElements.ClearSelection();
-        }
-
-
         private float X = 1;
         private float Y = 1;
         private void STDEditor_Resize(object sender, EventArgs e)
         {
-            float newx = (this.Width) / X;
-            float newy = this.Height / Y;
-            AmplificationFactor = newy;
-            setControls(newx, newy, this.tabSTDStandrad.TabPages[0]);
-            //button_Extend.BackColor = SystemColors.ControlDarkDark;
+            //float newx = (this.Width) / X;
+            //float newy = this.Height / Y;
+            //AmplificationFactor = newy;
+            //setControls(newx, newy, this.tabSTDStandrad.TabPages[0]);
+            ////button_Extend.BackColor = SystemColors.ControlDarkDark;
         }
 
         private void setTag(Control cons)
@@ -962,7 +904,7 @@ namespace SpectrumSTDEditor
                         MessageBox.Show("No matching energy spectrum data was found", "Tip");
                     }
                     m_dbConnection.Close();
-                    int color = Convert.ToInt32(ParseRGB(colorHx16toRGB(m_SubMidWindow.m_MainForm.STDDictionary[int.Parse(STDId)].Color)).ToString());
+                    int color = Convert.ToInt32(m_SubMidWindow.m_MainForm.STDDictionary[int.Parse(STDId)].Color);
                     for(int i=0;i< m_STDXrayList.Count;i++)
                     {
                         if(m_STDXrayList[i].StdID== STDId)

+ 28 - 32
SpectrumSTDEditor/UI/STDRuleslist.cs

@@ -1,13 +1,9 @@
 using OTS.WinFormsUI.Docking;
 using SourceGrid;
+using SpectrumSTDEditor.BaseClass;
 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.Windows.Forms;
 
 namespace SpectrumSTDEditor
@@ -79,7 +75,7 @@ namespace SpectrumSTDEditor
 
                 Grid_Minerals[i, 1] = new SourceGrid.Cells.Cell();
                 SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell();
-                view.BackColor = colorHx16toRGB(kv.Value.Color);
+                view.BackColor = shareFunction.string10ToColor(shareFunction.ObtainRandomColor());
                 Grid_Minerals[i, 1].View = view;
                 i++;
             }
@@ -99,24 +95,24 @@ namespace SpectrumSTDEditor
         /// </summary>
         /// <param name="strColor">设置16进制颜色 [返回RGB]</param>
         /// <returns></returns>
-        public static System.Drawing.Color colorHx16toRGB(string strHxColor)
-        {
-            try
-            {
-                if (strHxColor.Length == 0)
-                {//如果为空
-                    return System.Drawing.Color.FromArgb(255, 255, 204);//设为白色
-                }
-                else
-                {//转换颜色
-                    return System.Drawing.Color.FromArgb(System.Int32.Parse(strHxColor.Substring(1, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(3, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(5, 2), System.Globalization.NumberStyles.AllowHexSpecifier));
-                }
-            }
-            catch
-            {//设为白色
-                return System.Drawing.Color.FromArgb(255, 255, 204);
-            }
-        }
+        //public static System.Drawing.Color colorHx16toRGB(string strHxColor)
+        //{
+        //    try
+        //    {
+        //        if (strHxColor.Length == 0)
+        //        {//如果为空
+        //            return System.Drawing.Color.FromArgb(255, 255, 204);//设为白色
+        //        }
+        //        else
+        //        {//转换颜色
+        //            return System.Drawing.Color.FromArgb(System.Int32.Parse(strHxColor.Substring(1, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(3, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(5, 2), System.Globalization.NumberStyles.AllowHexSpecifier));
+        //        }
+        //    }
+        //    catch
+        //    {//设为白色
+        //        return System.Drawing.Color.FromArgb(255, 255, 204);
+        //    }
+        //}
 
         private void MineralsGrid_Click(object sender, EventArgs e)
         {
@@ -180,7 +176,7 @@ namespace SpectrumSTDEditor
                             m_MainForm.SaveDataOfSelRule(i, j);
 
                             int STDId = m_MainForm.AddSTDDictionaryItem();
-                            AddNewRow(STDId, "NewRuleName", Attributes.colorHx16toRGB(m_MainForm.STDDictionary[STDId].Color));
+                            AddNewRow(STDId, "NewRuleName", shareFunction.string10ToColor(shareFunction.ObtainRandomColor()));
                             m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
                 //        }
                 //    }
@@ -189,7 +185,7 @@ namespace SpectrumSTDEditor
             else
             {
                 int STDId = m_MainForm.AddSTDDictionaryItem();
-                AddNewRow(STDId, "NewRuleName", Attributes.colorHx16toRGB(m_MainForm.STDDictionary[STDId].Color));
+                AddNewRow(STDId, "NewRuleName", shareFunction.string10ToColor(shareFunction.ObtainRandomColor()));
                 m_MainForm.m_SubMidWindow.m_ComparativeLibrary.MakeCheckboxUnchecked();
             }
             //SetOrderButtonsStatus();
@@ -378,8 +374,8 @@ namespace SpectrumSTDEditor
                 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.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[Grid_Minerals.Selection.ActivePosition.Row, 1].View.BackColor = m_MainForm.m_Attributes.Grid_Attributes[4, 1].View.BackColor;
+                m_MainForm.STDDictionary[(int)Grid_Minerals[Grid_Minerals.Selection.ActivePosition.Row, 0].Tag].Color= shareFunction.ColorTostring10(m_MainForm.m_Attributes.Grid_Attributes[4, 1].View.BackColor);
                 Grid_Minerals.Refresh();
                 return (int)Grid_Minerals[Grid_Minerals.Selection.ActivePosition.Row, 0].Tag;
             }
@@ -405,13 +401,13 @@ namespace SpectrumSTDEditor
             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.STDDictionary[id2].Color);
+            view.BackColor = shareFunction.string10ToColor(m_MainForm.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.STDDictionary[id].Color);
+            view2.BackColor = shareFunction.string10ToColor(m_MainForm.STDDictionary[id].Color);
             Grid_Minerals[selrow - 1, 1].View = view2;
 
             m_MainForm.STDDictionary[id].StrName = Grid_Minerals[selrow - 1, 0].Value.ToString();
@@ -444,13 +440,13 @@ namespace SpectrumSTDEditor
             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.STDDictionary[id2].Color);
+            view.BackColor = shareFunction.string10ToColor(m_MainForm.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.STDDictionary[id].Color);
+            view2.BackColor = shareFunction.string10ToColor(m_MainForm.STDDictionary[id].Color);
             Grid_Minerals[selrow + 1, 1].View = view2;
 
             m_MainForm.STDDictionary[id].StrName = Grid_Minerals[selrow + 1, 0].Value.ToString();

+ 7 - 63
SpectrumSTDEditor/UI/SubMidWindow.cs

@@ -1,14 +1,5 @@
 using OTS.WinFormsUI.Docking;
 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.Windows.Forms;
-
 namespace SpectrumSTDEditor
 {
     public partial class SubMidWindow : DockContent
@@ -16,13 +7,12 @@ namespace SpectrumSTDEditor
         public Form_Main m_MainForm = null;
         public STDEditor m_STDEditor = null;
         public ReferenceLibrary m_ComparativeLibrary = null;
-
         public SubMidWindow(Form_Main mainForm)
         {
             InitializeComponent();
 
             m_MainForm = mainForm;
-            m_STDEditor = new STDEditor(this,m_MainForm.STDDBAddress);
+            m_STDEditor = new STDEditor(this, m_MainForm.STDDBAddress);
             m_ComparativeLibrary = new ReferenceLibrary(this);
         }
 
@@ -33,66 +23,20 @@ namespace SpectrumSTDEditor
         }
         public void CreateSubMidWindow()
         {
-            dockPanel1.DockTopPortion = 660;
+            dockPanel1.DockTopPortion = 700;
             dockPanel1.DockBottomPortion = 550;
             m_STDEditor.DockAreas = DockAreas.DockTop;
             m_STDEditor.Show(dockPanel1, DockState.DockTop);
             m_ComparativeLibrary.DockAreas = DockAreas.DockBottom;
             m_ComparativeLibrary.Show(dockPanel1, DockState.DockBottom);
 
-            m_STDEditor.AutoHidePortion = 0.55;
-            m_ComparativeLibrary.AutoHidePortion = 0.35;
-
-            //m_SubMidWindow.m_STDEditor.Show(m_SubMidWindow.dockPanel1, OTS.WinFormsUI.Docking.DockState.DockTop);
-            //m_SubMidWindow.m_STDEditor.DockAreas = OTS.WinFormsUI.Docking.DockAreas.DockTop;
-            //m_SubMidWindow.m_ComparativeLibrary.Show(m_SubMidWindow.m_STDEditor.Pane, OTS.WinFormsUI.Docking.DockAlignment.Bottom, 0.5);
-            //m_SubMidWindow.m_ComparativeLibrary.DockAreas = OTS.WinFormsUI.Docking.DockAreas.DockTop;
+            m_STDEditor.AutoHidePortion = 0.75;
+            m_ComparativeLibrary.AutoHidePortion = 0.25;
         }
-
-        public void ChangeText_textbox_STDEditor(int STDId)
+        public void SelSTDXray(int Key, STDdata sT)
         {
-            m_STDEditor.textbox_STDEditor.Text = m_MainForm.STDDictionary[STDId].Expression;
-            m_STDEditor.STDId = STDId;
-
-            m_STDEditor.dataGridView_KeyElements.Rows.Clear();
-            m_STDEditor.dataGridView_KeyElements.Columns.Clear();
-
-            string[] KeyElement = m_MainForm.STDDictionary[STDId].KeyElementList.Trim().Split(',');
-            for (int i = 0; i < KeyElement.Length; i++)
-            {
-                if (KeyElement[0] != "")
-                {
-                    DataGridViewButtonColumn dataGridViewButtonColumn = new DataGridViewButtonColumn();
-                    dataGridViewButtonColumn.Name = m_STDEditor.dataGridView_SubElements.Columns.Count.ToString();
-                    m_STDEditor.dataGridView_KeyElements.Columns.Add(dataGridViewButtonColumn);
-                    if (m_STDEditor.dataGridView_KeyElements.Rows.Count == 0)
-                    {
-                        DataGridViewRow row = new DataGridViewRow();
-                        m_STDEditor.dataGridView_KeyElements.Rows.Add(row);
-                    }
-                    m_STDEditor.dataGridView_KeyElements.Rows[0].Cells[i].Value = KeyElement[i];
-                }
-            }
-
-            m_STDEditor.dataGridView_SubElements.Rows.Clear();
-            m_STDEditor.dataGridView_SubElements.Columns.Clear();
-
-            string[] SubElement = m_MainForm.STDDictionary[STDId].SubElementList.Trim().Split(',');
-            for (int i = 0; i < SubElement.Length; i++)
-            {
-                if (SubElement[i] != "")
-                {
-                    DataGridViewButtonColumn dataGridViewButtonColumn = new DataGridViewButtonColumn();
-                    dataGridViewButtonColumn.Name = m_STDEditor.dataGridView_SubElements.Columns.Count.ToString();
-                    m_STDEditor.dataGridView_SubElements.Columns.Add(dataGridViewButtonColumn);
-                    if (m_STDEditor.dataGridView_SubElements.Rows.Count == 0)
-                    {
-                        DataGridViewRow row = new DataGridViewRow();
-                        m_STDEditor.dataGridView_SubElements.Rows.Add(row);
-                    }
-                    m_STDEditor.dataGridView_SubElements.Rows[0].Cells[i].Value = SubElement[i];
-                }
-            }
+            m_STDEditor.ShowEditContent(Key.ToString());
+            m_STDEditor.SelSTDXray(Key, sT);
         }
     }
 }

+ 48 - 0
SpectrumSTDEditor/UI/UXrayControl.Designer.cs

@@ -0,0 +1,48 @@
+namespace SpectrumSTDEditor
+{
+    partial class UXrayControl
+    {
+        /// <summary> 
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region 组件设计器生成的代码
+
+        /// <summary> 
+        /// 设计器支持所需的方法 - 不要修改
+        /// 使用代码编辑器修改此方法的内容。
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.SuspendLayout();
+            // 
+            // UXrayControl
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.BackColor = System.Drawing.Color.White;
+            this.Name = "UXrayControl";
+            this.Load += new System.EventHandler(this.UXrayControl_Load);
+            this.Paint += new System.Windows.Forms.PaintEventHandler(this.UXrayControl_Paint);
+            this.Resize += new System.EventHandler(this.UXrayControl_Resize);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+    }
+}

+ 486 - 0
SpectrumSTDEditor/UI/UXrayControl.cs

@@ -0,0 +1,486 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Data;
+using System.Windows.Forms;
+
+namespace SpectrumSTDEditor
+{
+    public partial class UXrayControl : UserControl
+    {
+        // 画能谱图的矩形区域
+        protected Rectangle m_XrayArea;
+        protected PointF[] m_xraypointf = null;
+        protected bool m_bShowElementLines = true;
+        // 水平刻度分成20等分
+        protected const int m_iHscale = 20;
+        protected bool m_bMouseMove = false;
+        protected Point m_curCurssorPos;
+        private DataTable dt = null;
+        private DataRow dr = null;
+        public DataRow Dr { get => dr; set => dr = value; }
+        public DataTable Dt { get => dt; set => dt = value; }
+
+        public UXrayControl()
+        {
+            InitializeComponent();
+            // 设置双缓冲
+            SetDoubleBufferByIsDraw();
+        }
+
+        public void SetDoubleBufferByIsDraw()
+        {
+            SetStyle(ControlStyles.UserPaint, true);//没什么效果,开与关
+            SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景,关了闪
+            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); // 双缓冲,关了闪
+
+            //上面是必须有的
+            SetStyle(ControlStyles.UserMouse, true);//执行自己的鼠标行为,这个打开后,在win7下鼠标操作明显改善
+        }
+
+        private void UXrayControl_Load(object sender, EventArgs e)
+        {
+
+        }
+
+        private void UXrayControl_Resize(object sender, EventArgs e)
+        {
+            this.RefreshCtrl();
+            //setControls(newx, newy, this.tabSTDStandrad.TabPages[0]);
+        }
+
+        private void UXrayControl_Paint(object sender, PaintEventArgs e)
+        {
+            Graphics graphic = e.Graphics;
+            DrawSpecture(ref graphic);
+
+            if (m_bMouseMove)
+            {
+                ShowMouseMoveInfo(m_curCurssorPos.X, m_curCurssorPos.Y, ref m_XrayArea, ref graphic);
+            }
+        }
+
+        public void RefreshCtrl()
+        {
+            this.Invalidate();
+            Graphics graph = Graphics.FromHwnd(this.Handle);
+            DrawSpecture(ref graph);
+            m_bMouseMove = false;
+        }
+
+        public void DrawSpecture(ref Graphics graph)
+        {
+            // 设置设置能谱的区域大小
+            // 首先预留出刻度的大小
+            String strLabel = "99999";
+            SizeF size = graph.MeasureString(strLabel, this.Font);
+
+            // 上下左右四顶点预留2个像素空白, 扣除标签的宽高
+            //            Rectangle XrayArea = new Rectangle();
+            m_XrayArea.X = 2 + (int)size.Width;
+            m_XrayArea.Y = 5;
+            m_XrayArea.Width = this.Width - 2 - m_XrayArea.X;
+            m_XrayArea.Height = this.Height - 2 - m_XrayArea.Y - (int)size.Height;
+
+            Pen pen = new Pen(Color.FromArgb(150, Color.Black), 1);
+
+            // 画矩形框
+            graph.DrawRectangle(pen, m_XrayArea);
+
+            // 画横坐标刻度
+            Point point = new Point();
+            Point next = new Point();
+            Point adapt = new Point();  // 微调参数
+            SolidBrush brush = new SolidBrush(Color.FromArgb(255, Color.Black));
+            pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
+            for (int i = 0; i < m_iHscale; i++)
+            {
+                point.X = m_XrayArea.X + i * m_XrayArea.Width / m_iHscale;
+                point.Y = m_XrayArea.Y + m_XrayArea.Height;
+
+                // 画横坐标数字刻度
+                adapt.X = (i > 9) ? 6 : 4;
+                adapt.Y = 2;
+                graph.DrawString(Convert.ToString(i), this.Font, brush, new Point(point.X - adapt.X, point.Y + adapt.Y));
+
+                // 画垂直方向刻度
+                next.X = point.X;
+                next.Y = m_XrayArea.Y;
+                pen.Color = Color.FromArgb(70, Color.Black);
+                graph.DrawLine(pen, point, next);
+            }
+
+            // 画纵坐标的刻度
+            int iRows = 0;
+            int iMaxValue = 0;
+            int iScale = GetYScale(ref iMaxValue);
+            iRows = iMaxValue / iScale;
+            for (int i = 1; i < iRows; i++)
+            {
+                point.Y = m_XrayArea.Y + m_XrayArea.Height - i * m_XrayArea.Height / iRows;
+                point.X = m_XrayArea.X;
+
+                // 画纵坐标数字刻度
+                adapt.X = (i * iScale >= 100) ? 22 : 16;
+                adapt.X = (i * iScale >= 1000) ? 28 : adapt.X;
+                adapt.Y = 6;
+
+                string drawstring = Convert.ToString(iScale * i);
+                int a1= strLabel.Length-drawstring.Length;
+                graph.DrawString(drawstring, this.Font, brush, new Point(point.X-7 - adapt.X, point.Y +2 - adapt.Y));
+
+                // 画水平方向刻度
+                next.X = point.X + m_XrayArea.Width;
+                next.Y = point.Y;
+                graph.DrawLine(pen, point, next);
+            }
+
+            // 画能谱数据
+            //            ShowXray(ref m_XrayArea, iMaxValue, ref graph, m_bShowElementLines);
+            ShowXrayClr(ref m_XrayArea, iMaxValue, ref graph, m_bShowElementLines);
+        }
+
+        protected void ShowXrayClr(ref Rectangle XrayArea, int iMaxValue, ref Graphics graph, bool bShowElementLines)
+        {
+            ShowXray( Dr, ref XrayArea, iMaxValue, ref graph);
+
+            if (bShowElementLines)
+            {
+                // 元素线的高度为能谱图矩形高度一半
+                ShowElementLines(Dr, XrayArea.Height / 2, ref XrayArea, ref graph);
+            }
+
+            if (null != Dr)
+            {
+                int iDelt = 0;
+                SizeF size = graph.MeasureString("Test", this.Font);
+                for (int i = 0; i < 1; i++)
+                {
+                    //DataRow dr = Dt.Rows[i];
+                    ShowXray(Dr, ref XrayArea, iMaxValue, ref graph, true);
+
+                    if (bShowElementLines)
+                    {
+                        iDelt = (0 == i % 2) ? (-i - 1) * (int)size.Height : i * (int)size.Height;
+                        ShowElementLines(dr, iDelt + XrayArea.Height / 2, ref XrayArea, ref graph);
+                    }
+                }
+            }
+        }
+        protected int[] bytesToInt(byte[] src, int offset)
+        {
+            int[] values = new int[src.Length / 4];
+            for (int i = 0; i < values.Length; i++)
+            {
+                values[i] = BitConverter.ToInt32(src, offset);
+                offset += 4;
+            }
+            return values;
+        }
+        public void ShowXray(DataRow dr, ref Rectangle XrayArea, int iMaxValue, ref Graphics graph, bool bComp = false)
+        {
+            if (null != dr)
+            {
+                int[] SPEC= bytesToInt((byte[])dr["SPEC"], 0);
+                int iXrayDataLen = SPEC.Length;
+                if (null == m_xraypointf)
+                {
+                    m_xraypointf = new PointF[iXrayDataLen];
+                }
+                for (int i = 0; i < iXrayDataLen; i++)
+                {
+                    m_xraypointf[i].X = XrayArea.X + i * XrayArea.Width / iXrayDataLen;
+                    m_xraypointf[i].Y = XrayArea.Y + XrayArea.Height - SPEC[i] * XrayArea.Height / iMaxValue;
+                }
+                int ColorValue = 0;
+                if (!dr["Color"].ToString().Equals(""))
+                {
+                    ColorValue = Convert.ToInt32(dr["Color"]);
+                }
+                if (bComp)
+                {
+                    Pen pen = new Pen(Color.FromArgb(150, Color.FromArgb(ColorValue % 256, (ColorValue >> 8) % 256, (ColorValue >> 16) % 256)), 1);
+                    graph.DrawPolygon(pen, m_xraypointf);
+                }
+                else
+                {
+                    SolidBrush brush = new SolidBrush(Color.FromArgb(150, Color.FromArgb(ColorValue % 256, (ColorValue >> 8) % 256, (ColorValue >> 16) % 256)));
+                    graph.FillPolygon(brush, m_xraypointf);
+                }
+            }
+        }
+
+        protected void ShowElementLines(DataRow dr, int iLineHeight, ref Rectangle XrayArea, ref Graphics graph)
+        {
+            if (null == dr)
+            {
+                return;
+            }
+            //double dEnergy = 0;
+            String str = "Test";
+            SizeF size = graph.MeasureString(str, this.Font);
+
+            // 判断元素线高度的合法性
+            iLineHeight = (iLineHeight > size.Height) ? iLineHeight : (int)size.Height;
+            iLineHeight = ((iLineHeight + (int)size.Height) > XrayArea.Height) ? (XrayArea.Height - (int)size.Height) : iLineHeight;
+
+            //PointF point = new PointF();
+            //PointF next = new PointF();
+            //RectangleF rect = new RectangleF();
+            Pen pen = new Pen(Color.FromArgb(255, 150, 100, 50), 1);
+            int ColorValue = 0;
+            if (!dr["Color"].ToString().Equals(""))
+            {
+                ColorValue = Convert.ToInt32(dr["Color"]);
+            }
+            SolidBrush brush = new SolidBrush(Color.FromArgb(255, Color.FromArgb(ColorValue % 256, (ColorValue >> 8) % 256, (ColorValue >> 16) % 256)));
+            //for (int i = 0; i < 1; i++)
+            //{
+            //    //CElementClr elementclr = stdmineralclr.GetElement(i);
+            //    str = "0";//elementclr.GetName();
+            //    size = graph.MeasureString(str, this.Font);
+            //    dEnergy = 2.3;//elementclr.GetEnergyValueK();
+
+            //    point.X = XrayArea.X + (float)dEnergy * XrayArea.Width / m_iHscale;
+            //    point.Y = XrayArea.Y + XrayArea.Height;
+
+            //    next.X = point.X;
+            //    next.Y = (0 == i % 2) ? (point.Y - iLineHeight) : (point.Y - iLineHeight + 2 + (int)size.Height);
+
+            //    // 画线
+            //    graph.DrawLine(pen, point, next);
+
+            //    // 画矩形框
+            //    rect.X = next.X - size.Width / 2;
+            //    rect.Y = next.Y - size.Height;
+            //    rect.Width = size.Width;
+            //    rect.Height = size.Height;
+
+            //    brush.Color = Color.FromArgb(255, Color.FromArgb(ColorValue % 256, (ColorValue >> 8) % 256, (ColorValue >> 16) % 256));
+            //    graph.FillRectangle(brush, rect);
+
+            //    // 画字符串
+            //    brush.Color = Color.FromArgb(255, Color.Black);
+            //    graph.DrawString(str, this.Font, brush, rect.X, rect.Y);
+            //}
+        }
+
+        protected void ShowMouseMoveInfo(int ix, int iy, ref Rectangle XrayArea, ref Graphics graph)
+        {
+            // 判断坐标是否在矩形框区域内, 如果不在, 则退出
+            if (ix < XrayArea.X ||
+                ix > XrayArea.X + XrayArea.Width ||
+                iy < XrayArea.Y ||
+                iy > XrayArea.Y + XrayArea.Height)
+            {
+                return;
+            }
+            float fpos = 0;
+            PointF point = new PointF();
+            PointF next = new PointF();
+            Pen pen = new Pen(Color.FromArgb(150, Color.Black), 1);
+            SolidBrush brush = new SolidBrush(Color.FromArgb(255, Color.FromArgb(255, 0, 0)));
+
+            fpos = (ix - XrayArea.X) * m_iHscale / (float)XrayArea.Width;
+            SizeF size = graph.MeasureString(fpos.ToString(), this.Font);
+
+            // 画竖线
+            point.X = ix;
+            point.Y = XrayArea.Y + XrayArea.Height;
+
+            next.X = point.X;
+            next.Y = XrayArea.Y + (int)size.Height;
+
+            graph.DrawLine(pen, point, next);
+
+            // 显示坐标位置
+            graph.DrawString(fpos.ToString(), this.Font, brush, ix - (int)(size.Width / 2), XrayArea.Y+20);
+
+            // 获取当前位置的元素
+            //            List<String> liststr = CElement.GetAllElementsEnergy(fpos, 0.1f);
+            List<String> liststr = new List<string>();
+            //CElementClr.GetAllElementsEnergyK(fpos, 0.1f, ref liststr);
+
+            brush.Color = Color.FromArgb(255, Color.Blue);
+            for (int i = 0; i < liststr.Count; i++)
+            {
+                size = graph.MeasureString(liststr[i], this.Font);
+
+                point.X = ('-' == liststr[i][0]) ? (ix - (size.Width + 2)) : ix;
+                point.Y = (XrayArea.Y + size.Height) + i * (size.Height + 2);
+
+                graph.DrawString(liststr[i], this.Font, brush, point.X, point.Y);
+            }
+        }
+        
+
+        public void SetElementLines(bool bShowElementLines)
+        {
+            m_bShowElementLines = bShowElementLines;
+        }
+
+        
+        protected override void OnMouseMove(MouseEventArgs e)
+        {
+            ////            if (null == m_CurSelMineral &&
+            ////                (null == m_ListCompMineral ||
+            ////                0 == m_ListCompMineral.Count()))
+            //if (null == m_CurSelSTDMineralClr &&
+            //    (null == m_ListCompMineralClr ||
+            //    0 == m_ListCompMineralClr.Count()))
+            //{
+            //    return;
+            //}
+            m_bMouseMove = true;
+
+            m_curCurssorPos.X = e.X;
+            m_curCurssorPos.Y = e.Y;
+
+            this.Invalidate();
+            //            this.OnPaint(new PaintEventArgs(this.CreateGraphics(), new Rectangle(new Point(0, 0), this.Size)));
+        }
+
+        // 返回值是刻度的精度, iRows表示行数
+        protected int GetYScale(ref int iMaxValue)
+        {
+            int iMaxXray = 0;
+            int iMaxXray1 = 0;
+            int iMaxXray2 = 0;
+            int iBaseScale = 20;    // 最小基础刻度20
+            int iScale = 20;        // 待返回的刻度值
+            int iBaseMaxValue = 100;   // 基础最大值100
+            int iTimes = 0;
+            int iLeft = 0;
+
+            iMaxXray1 = GetMaxXray(Dr);
+            iMaxXray2 = 0;//GetMaxXrayClr();
+
+            iMaxXray = (iMaxXray1 > iMaxXray2) ? iMaxXray1 : iMaxXray2;
+
+            // 设计需求: 0 <= iMaxXray < 500(iScale: 50, iMaxValue: 250或者500)
+            // 设计需求: 500 <= iMaxXray < 1000(iScale: 100, iMaxValue: 750或者1000)
+            // 设计需求: 1000 <= iMaxXray < 1500(iScale: 150, iMaxValue: 1250或者1500)
+            // 设计需求: 1500 <= iMaxXray < 2000(iScale: 200, iMaxValue: 1750或者2000)
+            // 以此类推
+            //            iMaxXray = 9000;// 测试代码, 可以删除
+            iTimes = iMaxXray / iBaseMaxValue;
+            iLeft = iMaxXray % iBaseMaxValue;
+
+            iScale = iBaseScale + iBaseScale * (iTimes / 2);
+            iMaxValue = iBaseMaxValue + iBaseMaxValue * iTimes;
+
+            // 因为iScale * (iMaxValue / iScale) <= iMaxValue, 所以如果 iMaxXray > iScale * (iMaxValue / iScale) 刻度就会不够,导致bug
+            if (iScale * (iMaxValue / iScale) < iMaxXray)
+            {
+                iMaxValue = iMaxValue + iBaseMaxValue;
+            }
+            return iScale;
+        }
+
+        protected int GetMaxXray(DataRow dr)
+        {
+            if (null == dr)
+            {
+                return 0;
+            }
+            int iMaxXray = 0;
+            int iXrayLen = 0;
+            int[] SPEC = bytesToInt((byte[])dr["SPEC"], 0);
+            iXrayLen = SPEC.Length;
+            for (int i = 0; i < iXrayLen; i++)
+            {
+                if (SPEC[i] > iMaxXray)
+                {
+                    iMaxXray = SPEC[i];
+                }
+            }
+            return iMaxXray;
+        }
+
+        protected int GetMaxXrayClr()
+        {
+            if (null == Dr)
+            {
+                return 0;
+            }
+            int iMaxXray = 0;
+            int iXray = 0;
+            for (int i = 0; i < Dt.Rows.Count; i++)
+            {
+                DataRow dr = Dt.Rows[i];
+                iXray = GetMaxXray(dr);
+                if (iXray > iMaxXray)
+                {
+                    iMaxXray = iXray;
+                }
+            }
+            return iMaxXray;
+        }
+        private void setTag(Control cons)
+        {
+            foreach (Control con in cons.Controls)
+            {
+                con.Tag = con.Width + ":" + con.Height + ":" + con.Left + ":" + con.Top + ":" + con.Font.Size;
+                if (con.Controls.Count > 0)
+                    setTag(con);
+            }
+        }
+        private void setControls(float newx, float newy, Control cons)
+        {
+            foreach (Control con in cons.Controls)
+            {
+                if (con.Name == "Form_ZeroElementRules")
+                {
+                    continue;
+                }
+                if (false)
+                {
+
+                }
+                else
+                {
+                    string[] mytag = con.Tag.ToString().Split(':');
+
+                    float a = Convert.ToSingle(mytag[0]) * newx;
+                    con.Width = (int)a;
+
+                    a = Convert.ToSingle(mytag[1]) * newy;
+                    con.Height = (int)(a);
+
+                    a = Convert.ToSingle(mytag[2]) * newx;
+                    con.Left = (int)(a);
+
+                    a = Convert.ToSingle(mytag[3]) * newy;
+                    con.Top = (int)(a);
+
+                    Single currentSize;
+
+                    if (con.GetType().ToString() == "System.Windows.Forms.Label")
+                    {
+                        currentSize = Convert.ToSingle(mytag[4]) * ((newx + newy) / 2);
+                        //currentSize = 6f;
+                    }
+                    else
+                    {
+                        if (Math.Max(newx, newy) < 1)
+                        {
+                            currentSize = Convert.ToSingle(mytag[4]) * 1;
+                        }
+                        else
+                        {
+                            currentSize = Convert.ToSingle(mytag[4]) * Math.Max(newx, newy);
+
+                        }
+                    }
+
+                    con.Font = new Font(con.Font.Name, currentSize, con.Font.Style, con.Font.Unit);
+                    if (con.Controls.Count > 0)
+                    {
+                        setControls(newx, newy, con);
+                    }
+
+                }
+            }
+        }
+    }
+}

+ 0 - 0
OTSPartA_STDEditor/UI/Form_UserConstants.resx → SpectrumSTDEditor/UI/UXrayControl.resx


+ 158 - 0
SpectrumSTDEditor/UI/XrayContrastForm.Designer.cs

@@ -0,0 +1,158 @@
+namespace SpectrumSTDEditor
+{
+    partial class XrayContrastForm
+    {
+        /// <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.dgV_IncALib = new System.Windows.Forms.DataGridView();
+            this.panel1 = new System.Windows.Forms.Panel();
+            this.label1 = new System.Windows.Forms.Label();
+            this.label9 = new System.Windows.Forms.Label();
+            this.txtCollectTime = new System.Windows.Forms.TextBox();
+            this.btnCollectXray = new System.Windows.Forms.Button();
+            this.plXray = new System.Windows.Forms.Panel();
+            ((System.ComponentModel.ISupportInitialize)(this.dgV_IncALib)).BeginInit();
+            this.panel1.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // dgV_IncALib
+            // 
+            this.dgV_IncALib.AllowUserToAddRows = false;
+            this.dgV_IncALib.AllowUserToDeleteRows = false;
+            this.dgV_IncALib.AllowUserToResizeColumns = false;
+            this.dgV_IncALib.AllowUserToResizeRows = false;
+            this.dgV_IncALib.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight;
+            this.dgV_IncALib.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            this.dgV_IncALib.Dock = System.Windows.Forms.DockStyle.Bottom;
+            this.dgV_IncALib.Location = new System.Drawing.Point(0, 323);
+            this.dgV_IncALib.Margin = new System.Windows.Forms.Padding(2);
+            this.dgV_IncALib.MultiSelect = false;
+            this.dgV_IncALib.Name = "dgV_IncALib";
+            this.dgV_IncALib.ReadOnly = true;
+            this.dgV_IncALib.RowHeadersVisible = false;
+            this.dgV_IncALib.RowHeadersWidth = 23;
+            this.dgV_IncALib.RowTemplate.Height = 30;
+            this.dgV_IncALib.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
+            this.dgV_IncALib.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+            this.dgV_IncALib.Size = new System.Drawing.Size(964, 408);
+            this.dgV_IncALib.TabIndex = 16;
+            this.dgV_IncALib.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgV_IncALib_CellClick);
+            // 
+            // panel1
+            // 
+            this.panel1.BackColor = System.Drawing.SystemColors.ActiveCaption;
+            this.panel1.Controls.Add(this.label1);
+            this.panel1.Controls.Add(this.label9);
+            this.panel1.Controls.Add(this.txtCollectTime);
+            this.panel1.Controls.Add(this.btnCollectXray);
+            this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
+            this.panel1.Location = new System.Drawing.Point(0, 0);
+            this.panel1.Name = "panel1";
+            this.panel1.Size = new System.Drawing.Size(964, 27);
+            this.panel1.TabIndex = 18;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Font = new System.Drawing.Font("宋体", 9F);
+            this.label1.Location = new System.Drawing.Point(12, 7);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(71, 12);
+            this.label1.TabIndex = 31;
+            this.label1.Text = "CollectTime";
+            // 
+            // label9
+            // 
+            this.label9.AutoSize = true;
+            this.label9.Font = new System.Drawing.Font("宋体", 9F);
+            this.label9.Location = new System.Drawing.Point(143, 8);
+            this.label9.Name = "label9";
+            this.label9.Size = new System.Drawing.Size(17, 12);
+            this.label9.TabIndex = 30;
+            this.label9.Text = "MS";
+            // 
+            // txtCollectTime
+            // 
+            this.txtCollectTime.Location = new System.Drawing.Point(85, 3);
+            this.txtCollectTime.Name = "txtCollectTime";
+            this.txtCollectTime.Size = new System.Drawing.Size(56, 21);
+            this.txtCollectTime.TabIndex = 28;
+            this.txtCollectTime.Text = "120";
+            this.txtCollectTime.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            // 
+            // btnCollectXray
+            // 
+            this.btnCollectXray.Location = new System.Drawing.Point(163, 2);
+            this.btnCollectXray.Name = "btnCollectXray";
+            this.btnCollectXray.Size = new System.Drawing.Size(68, 23);
+            this.btnCollectXray.TabIndex = 29;
+            this.btnCollectXray.TabStop = false;
+            this.btnCollectXray.Text = "Collect";
+            this.btnCollectXray.UseVisualStyleBackColor = true;
+            this.btnCollectXray.Click += new System.EventHandler(this.btnCollectXray_Click);
+            // 
+            // plXray
+            // 
+            this.plXray.Dock = System.Windows.Forms.DockStyle.Top;
+            this.plXray.Location = new System.Drawing.Point(0, 27);
+            this.plXray.Name = "plXray";
+            this.plXray.Size = new System.Drawing.Size(964, 298);
+            this.plXray.TabIndex = 19;
+            // 
+            // XrayContrastForm
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(964, 731);
+            this.Controls.Add(this.plXray);
+            this.Controls.Add(this.panel1);
+            this.Controls.Add(this.dgV_IncALib);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+            this.MaximizeBox = false;
+            this.MinimizeBox = false;
+            this.Name = "XrayContrastForm";
+            this.ShowIcon = false;
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+            this.Text = "Xray";
+            this.Load += new System.EventHandler(this.XrayContrastForm_Load);
+            ((System.ComponentModel.ISupportInitialize)(this.dgV_IncALib)).EndInit();
+            this.panel1.ResumeLayout(false);
+            this.panel1.PerformLayout();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+        public System.Windows.Forms.DataGridView dgV_IncALib;
+        private System.Windows.Forms.Panel panel1;
+        private System.Windows.Forms.Panel plXray;
+        private System.Windows.Forms.Label label9;
+        private System.Windows.Forms.TextBox txtCollectTime;
+        private System.Windows.Forms.Button btnCollectXray;
+        private System.Windows.Forms.Label label1;
+    }
+}

+ 867 - 0
SpectrumSTDEditor/UI/XrayContrastForm.cs

@@ -0,0 +1,867 @@
+using OTSCLRINTERFACE;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace SpectrumSTDEditor
+{
+    public partial class XrayContrastForm : Form
+    {
+        #region 全部变量
+        //数据库操作对象
+        //全局Xray 用于存储采集的Xray信息
+        byte[] xrayByteData = null;
+        private SqlLiteClass m_sc = null;
+        //Xray控件
+        UXrayControl xrayControl = null;
+        UXrayControl xrayContrastControl = null;
+        public DataRow dr = null;
+        public DataTable dt = null;
+        // 电镜设置对象
+        COTSControlFunExport m_cfun = null;
+        // 连接状态
+        bool m_bConnectionState = false;
+        //STD信息集合
+        public Dictionary<int, STDdata> STDDictionary = null;
+        //国际化
+        Language lan;
+        System.Collections.Hashtable table;
+        #endregion
+
+        /// <summary>
+        /// [颜色:16进制转成RGB]
+        /// </summary>
+        /// <param name="strColor">设置16进制颜色 [返回RGB]</param>
+        /// <returns></returns>
+        public static System.Drawing.Color colorHx16toRGB(string strHxColor)
+        {
+            try
+            {
+                if (strHxColor.Length == 0)
+                {//如果为空
+                    return System.Drawing.Color.FromArgb(255, 255, 204);//设为白色
+                }
+                else
+                {//转换颜色
+                    return System.Drawing.Color.FromArgb(System.Int32.Parse(strHxColor.Substring(1, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(3, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(5, 2), System.Globalization.NumberStyles.AllowHexSpecifier));
+                }
+            }
+            catch
+            {//设为白色
+                return System.Drawing.Color.FromArgb(255, 255, 204);
+            }
+        }
+
+        public XrayContrastForm()
+        {
+            InitializeComponent();
+        }
+
+        private void XrayContrastForm_Load(object sender, EventArgs e)
+        {
+            //加载Xray信息控件
+            xrayControl = new UXrayControl();
+            plXray.Controls.Add(xrayControl);
+            xrayControl.Dock = DockStyle.Top;
+            BindGrid_IncALib();
+            //比对
+            //GetCompMineralFun();
+            xrayContrastControl = new UXrayControl();
+            plXray.Controls.Add(xrayContrastControl);
+            xrayContrastControl.Dock = DockStyle.Top;
+            //国际化
+            lan = new Language(this);
+            table = lan.GetNameTable(this.Name);
+        }
+
+        #region 绑定Grid等相关方法
+
+        /// <summary>
+        /// 绑定STDGrid
+        /// </summary>
+        private void BindGrid_IncALib()
+        {
+            if (m_sc == null)
+            {
+                m_sc = new SqlLiteClass();
+            }
+            //查询
+            //DataTable dtSelDB = m_sc.GetDTFormSysSTDBySQLString("select Name,Id,0 Color,'' Hardness,'' density,'' Conductivity,'' BSEValue,'' formula,'' Element,SPEC,RowIndex,0 ReducedValue from ClassifySTD order by Name");  //STDMinerals
+            //DataTable dtSelDB = m_sc.GetDTFormSysSTDBySQLString("select 'C.StdName','C.StdId','C.Color','C.Hardness','C.Density','C.Electrical_conductivity','C.BSE','C.Formula','C.Element','M.SPEC' from ClassifySTD C,STDMinerals M WHERE C.StdId=M.id");  //STDMinerals
+            DataTable dtSelDB = m_sc.GetDTFormSysSTDBySQLString("select StrName,StdId,Color,Hardness,Density,Electrical_conductivity,BSE,Formula,Element,SPEC,0 ReducedValue from ClassifySTD left join STDMinerals on ClassifySTD.StdId = STDMinerals.id");  //STDMinerals
+            //绑定
+            BindDataGridView_dgV_IncALib(dtSelDB);
+            //样式
+            SetDataGridViewStyleIncLib();
+        }
+
+        /// <summary>
+        /// 使用DataTable绑定Grid
+        /// </summary>
+        /// <param name="in_dt"></param>
+        public void BindDataGridView_dgV_IncALib(DataTable dtSelDB)
+        {
+            dgV_IncALib.Rows.Clear();
+            dgV_IncALib.Columns.Clear();
+
+            //创建Grid的列
+            //名称
+            dgV_IncALib.Columns.Add("Name", "strName");
+            //编号
+            dgV_IncALib.Columns.Add("Code", "Code");
+            //代表色
+            dgV_IncALib.Columns.Add("Color", "Color");
+            //硬度
+            dgV_IncALib.Columns.Add("Hardness", "Hardness");
+            //密度
+            dgV_IncALib.Columns.Add("Density", "Density");
+            //导电性
+            dgV_IncALib.Columns.Add("Conductivity", "Conductivity");
+            //BSE
+            dgV_IncALib.Columns.Add("BSEValue", "BSE");
+            //化学式
+            dgV_IncALib.Columns.Add("Formula", "Formula");
+            //元素
+            dgV_IncALib.Columns.Add("Element", "Element");
+            dgV_IncALib.Columns.Add("Xray", "Xray");
+            dgV_IncALib.Columns.Add("RowIndex", "RowIndex");
+            dgV_IncALib.Columns.Add("ReducedValue", "ReducedValue");
+            //添加完成列后,再对不需要显示的列进行隐藏
+            dgV_IncALib.Columns["Code"].Visible = false;
+            dgV_IncALib.Columns["Color"].Visible = false;
+            dgV_IncALib.Columns["Xray"].Visible = false;
+            dgV_IncALib.Columns["RowIndex"].Visible = false;
+            dgV_IncALib.Columns["ReducedValue"].Visible = false;
+            //宽度
+            dgV_IncALib.Columns["Name"].Width = 140;//名称
+            dgV_IncALib.Columns["Code"].Width = 0;//编号
+            dgV_IncALib.Columns["Color"].Width = 0;//代表色
+            dgV_IncALib.Columns["Hardness"].Width = 80;//硬度
+            dgV_IncALib.Columns["Density"].Width = 80;//密度
+            dgV_IncALib.Columns["Conductivity"].Width = 60;//导电性
+            dgV_IncALib.Columns["BSEValue"].Width = 80;//BSE
+            dgV_IncALib.Columns["Formula"].Width = 240;//化学式
+            dgV_IncALib.Columns["Element"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;//元素
+            dgV_IncALib.Columns["Xray"].Width = 0;//Xray
+            dgV_IncALib.Columns["RowIndex"].Width = 0;//index
+            dgV_IncALib.Columns["ReducedValue"].Width = 0;//相识比对值
+
+            //先设置一下头的高度,否则会太矮不好看
+            dgV_IncALib.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing;
+            dgV_IncALib.ColumnHeadersHeight = 23;
+            //设置数据
+
+            //克隆 查询出的数据结构
+            dt = dtSelDB.Clone();
+
+            foreach (KeyValuePair<int, STDdata> kv in STDDictionary)
+            {
+                byte[] xrayData = new byte[8000];
+                DataRow[] dr = dtSelDB.Select("STDId=" + kv.Key);
+                if (dr != null)
+                {
+                    if (dr.Length > 0)
+                    {
+                        if (dr[0]["SPEC"].GetType().ToString()!= "System.DBNull")
+                        {
+                            xrayData = (byte[])dr[0]["SPEC"];
+                        }
+                        else
+                        {
+                            xrayData = new byte[2000];
+                        }
+                    }
+                }
+                //添加至全局dt
+                DataRow drSTD = dt.NewRow();
+                drSTD["StrName"] = kv.Value.StrName.ToString();
+                drSTD["StdId"] = kv.Key.ToString();
+                drSTD["Color"] = Convert.ToInt32(ParseRGB(colorHx16toRGB(kv.Value.Color)));
+                drSTD["Hardness"] = kv.Value.Hardness.ToString();
+                drSTD["Density"] = kv.Value.Density.ToString();
+                //drSTD["Electrical_conductivity"] = kv.Value.Electrical_conductivity.ToString();
+                drSTD["BSE"] = kv.Value.BSE.ToString();
+                drSTD["Formula"] = kv.Value.Formula.ToString();
+                drSTD["Element"] = kv.Value.Element.ToString();
+                drSTD["SPEC"] = xrayData;
+                dt.Rows.Add(drSTD);
+            }
+
+            //设置数据
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                int add_rowindex = dgV_IncALib.Rows.Add();
+                dgV_IncALib.Rows[add_rowindex].Cells[0].Value = i.ToString();
+                dgV_IncALib.Rows[i].Cells[0].Value = add_rowindex;
+
+                for (int k = 0; k < dt.Columns.Count; k++)
+                {
+                    dgV_IncALib.Rows[i].Cells[k].Value = dt.Rows[i][k].ToString();
+                }
+            }
+
+            //设置颜色
+            for (int i = 0; i < dgV_IncALib.Rows.Count; i++)
+            {
+                //在该数据库中返回的颜色格式与正常的不同,需要在前面加#号
+                Color ls_c = colorValuetoRGB(dgV_IncALib[2, i].Value.ToString());
+                dgV_IncALib[0, i].Style.BackColor = ls_c;
+            }
+        }
+
+        public void SortDataGridView_dgV_IncALib(DataTable dt)
+        {
+            dgV_IncALib.Rows.Clear();
+            dgV_IncALib.Columns.Clear();
+
+            //创建Grid的列
+            //名称
+            dgV_IncALib.Columns.Add("Name", "Name");
+            //编号
+            dgV_IncALib.Columns.Add("Code", "Code");
+            //代表色
+            dgV_IncALib.Columns.Add("Color", "Color");
+            //硬度
+            dgV_IncALib.Columns.Add("Hardness", "Hardness");
+            //密度
+            dgV_IncALib.Columns.Add("Density", "Density");
+            //导电性
+            dgV_IncALib.Columns.Add("Conductivity", "Conductivity");
+            //BSE
+            dgV_IncALib.Columns.Add("BSEValue", "BSE");
+            //化学式
+            dgV_IncALib.Columns.Add("Formula", "Formula");
+            //元素
+            dgV_IncALib.Columns.Add("Element", "Element");
+            dgV_IncALib.Columns.Add("Xray", "Xray");
+            dgV_IncALib.Columns.Add("RowIndex", "RowIndex");
+            dgV_IncALib.Columns.Add("ReducedValue", "ReducedValue");
+            //添加完成列后,再对不需要显示的列进行隐藏
+            dgV_IncALib.Columns["Code"].Visible = false;
+            dgV_IncALib.Columns["Color"].Visible = false;
+            dgV_IncALib.Columns["Xray"].Visible = false;
+            dgV_IncALib.Columns["RowIndex"].Visible = false;
+            dgV_IncALib.Columns["ReducedValue"].Visible = false;
+            //宽度
+            dgV_IncALib.Columns["Name"].Width = 140;//名称
+            dgV_IncALib.Columns["Code"].Width = 0;//编号
+            dgV_IncALib.Columns["Color"].Width = 0;//代表色
+            dgV_IncALib.Columns["Hardness"].Width = 80;//硬度
+            dgV_IncALib.Columns["Density"].Width = 80;//密度
+            dgV_IncALib.Columns["Conductivity"].Width = 60;//导电性
+            dgV_IncALib.Columns["BSEValue"].Width = 80;//BSE
+            dgV_IncALib.Columns["Formula"].Width = 240;//化学式
+            dgV_IncALib.Columns["Element"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;//元素
+            dgV_IncALib.Columns["Xray"].Width = 0;//Xray
+            dgV_IncALib.Columns["RowIndex"].Width = 0;//index
+            dgV_IncALib.Columns["ReducedValue"].Width = 0;//相识比对值
+
+            //先设置一下头的高度,否则会太矮不好看
+            dgV_IncALib.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing;
+            dgV_IncALib.ColumnHeadersHeight = 23;
+
+            //设置数据
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                int add_rowindex = dgV_IncALib.Rows.Add();
+                dgV_IncALib.Rows[add_rowindex].Cells[0].Value = i.ToString();
+                dgV_IncALib.Rows[i].Cells[0].Value = add_rowindex;
+
+                for (int k = 0; k < dt.Columns.Count; k++)
+                {
+                    dgV_IncALib.Rows[i].Cells[k].Value = dt.Rows[i][k].ToString();
+                }
+            }
+
+            //设置颜色
+            for (int i = 0; i < dgV_IncALib.Rows.Count; i++)
+            {
+                //在该数据库中返回的颜色格式与正常的不同,需要在前面加#号
+                Color ls_c = colorValuetoRGB(dgV_IncALib[2, i].Value.ToString());
+                dgV_IncALib[0, i].Style.BackColor = ls_c;
+            }
+        }
+        #region 自定义方法
+        /// <summary>
+        /// [颜色:16进制转成RGB]
+        /// </summary>
+        /// <param name="strColor">设置16进制颜色 [返回RGB]</param>
+        /// <returns></returns>
+        public System.Drawing.Color colorValuetoRGB(string strHxColor)
+        {
+            try
+            {
+                if (strHxColor.Length == 0)
+                {//如果为空
+                    return System.Drawing.Color.FromArgb(0, 0, 0);//设为黑色
+                }
+                else
+                {
+                    int colorValue = Convert.ToInt32(strHxColor);
+                    //转换颜色
+                    return Color.FromArgb(colorValue % 256, (colorValue >> 8) % 256, (colorValue >> 16) % 256);
+                }
+            }
+            catch (Exception)
+            {//设为黑色
+                return System.Drawing.Color.FromArgb(0, 0, 0);
+            }
+        }
+        /// <summary>
+        /// 将颜色对象转换为uint
+        /// </summary>
+        /// <param name="color"></param>
+        /// <returns></returns>
+        public uint ParseRGB(Color color)
+        {
+            return (uint)(((uint)color.B << 16) | (ushort)(((ushort)color.G << 8) | color.R));
+        }
+        #endregion
+        #region 设置Grid样式
+        /// <summary>
+        /// 设置夹杂物列表DataGridView样式
+        /// </summary>
+        private void SetDataGridViewStyleIncLib()
+        {
+            //用户不能调整标题的高度
+            dgV_IncALib.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
+
+            //用户不能调整 行高
+            dgV_IncALib.AllowUserToResizeRows = false;
+
+            //改变行的高度;
+            //Gview_gz.RowTemplate.Height = 20;
+
+            //点击选择整行
+            dgV_IncALib.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+
+            //居中显示
+            //System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
+            //dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            //dgV_IncALib.DefaultCellStyle = dataGridViewCellStyle1;
+            dgV_IncALib.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
+
+            //再次重覆禁用拖动表头高度,居然有效果了
+            dgV_IncALib.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
+
+            //设置grid可以复制
+            dgV_IncALib.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
+
+            //设置每列的宽度
+            //dgV_IncALib.Columns[1].Width = 40;//第一列序号的宽度设置一下吧,要不太丑
+
+            //设置序号列不排序
+            dgV_IncALib.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
+            for (int i = 0; i < dgV_IncALib.Columns.Count; i++)
+            {
+                dgV_IncALib.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
+            }
+
+            //设置序号列不可以设置宽度
+            dgV_IncALib.Columns[0].Resizable = DataGridViewTriState.False;
+            
+
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
+            dataGridViewCellStyle1.BackColor = System.Drawing.Color.LightCyan;
+            dgV_IncALib.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
+            dgV_IncALib.BackgroundColor = System.Drawing.Color.White;
+            dgV_IncALib.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+            dgV_IncALib.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
+            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;//211, 223, 240
+            dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(211)))), ((int)(((byte)(223)))), ((int)(((byte)(240)))));
+            dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            dataGridViewCellStyle2.ForeColor = System.Drawing.Color.Navy;
+            dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+            dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+            dgV_IncALib.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
+            dgV_IncALib.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            dgV_IncALib.EnableHeadersVisualStyles = false;
+            dgV_IncALib.GridColor = System.Drawing.SystemColors.GradientInactiveCaption;
+            dgV_IncALib.ReadOnly = true;
+            dgV_IncALib.RowHeadersVisible = true; //建议改为true;为了以后显示序号。
+            dgV_IncALib.RowTemplate.Height = 23;
+            dgV_IncALib.RowTemplate.ReadOnly = true;
+
+            //居中
+            dgV_IncALib.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
+            dgV_IncALib.AllowUserToOrderColumns = false;
+        }
+        #endregion
+        #endregion
+
+        #region Xray比对
+        private void GetCompMineralFun(byte[] collectXrayData)
+        {
+            byte[] stdmineralclr = collectXrayData;
+            List<byte[]> listOreTypeClr = new List<byte[]>();
+            foreach (DataRow item in dt.Rows)
+            {
+                if (item["SPEC"].GetType().ToString() != "System.DBNull")
+                {
+                    listOreTypeClr.Add((byte[])item["SPEC"]);
+                }
+                else
+                {
+                    listOreTypeClr.Add(new byte[2000]);
+                }
+            }
+            //获取信息中的相识度
+            List<double> returnValue = GetCompMineral(ref stdmineralclr, ref listOreTypeClr);
+            //向DataTable中添加
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                dt.Rows[i]["ReducedValue"] = returnValue[i];
+            }
+            //重新排列
+            dt.DefaultView.Sort = "ReducedValue desc";
+            dt = dt.DefaultView.ToTable();
+            SortDataGridView_dgV_IncALib(dt);
+            //设置选中DataGridView当前行
+            if (dgV_IncALib.Rows.Count > 0)
+            {
+                dgV_IncALib.Rows[0].Selected = true;
+
+                xrayControl.Dr = dt.Rows[0];
+                //xrayControl.Dt = dt;
+                xrayControl.Refresh();
+            }
+        }
+        // 在listOreTypeClr列表里找出和stdmineralclr相似的信息并返回
+        protected List<double> GetCompMineral(ref byte[] stdmineralclr, ref List<byte[]> listOreTypeClr)
+        {
+            if (null == stdmineralclr || null == listOreTypeClr)
+            {
+                return null;
+            }
+            if (0 == listOreTypeClr.Count())
+            {
+                return null;
+            }
+
+            int i = 0;
+            List<double> oretypeclr = new List<double>();
+            List<byte[]> listOreTypeClr_cmp = new List<byte[]>();
+            // 计算余弦值
+            double dCosValue = 0;
+            List<string> lstIgnoreElementNames = new List<string>();
+            for (i = 0; i < listOreTypeClr.Count; i++)
+            {
+                dCosValue = GetCosValue(0, ref lstIgnoreElementNames, stdmineralclr, listOreTypeClr[i]);
+                dCosValue = 1000000 * dCosValue;
+                oretypeclr.Add((int)dCosValue);// 将mineralid设置为余弦值
+            }
+            return oretypeclr;
+        }
+        // 20190903:增加参数iStartChannel哪个位置开始比较, lstIgnoreChannel里面的通道不处理
+        // 20191128:变更lstIgnoreChannel参数为lstIgnoreElementNames
+        protected double GetCosValue(int iStartChannel, ref List<string> lstIgnoreElementNames, byte[] stdmineralclr1, byte[] stdmineralclr2)
+        {
+            int iXrayDataLen = stdmineralclr1.Length;
+            List<int> lstIgnoreChannel = new List<int>();
+            if(stdmineralclr2==null)
+            {
+                return 0;
+            }
+            // 两者数据量不一致,返回0
+            if (iXrayDataLen != stdmineralclr2.Length)
+            {
+                return 0;
+            }
+
+            if (iStartChannel < 0 || iStartChannel >= iXrayDataLen)
+            {
+                return 1;
+            }
+
+            bool bignore = false;
+            int j = 0;
+            // 公式: (x1y1+x2y2+x3y3+...x2000y2000) / (sqrt(x1^2 + x2^2 + ...x2000^2) * sqrt(y1^2 + y2^2 + ...y2000^2))            
+            double dotpro = 0;
+            double d1 = 0;
+            double d2 = 0;
+            for (int i = iStartChannel; i < iXrayDataLen; i++)
+            {
+                bignore = false;
+                for (j = 0; j < lstIgnoreChannel.Count(); j++)
+                {
+                    if (lstIgnoreChannel[j] == i)
+                    {
+                        bignore = true;
+                        break;
+                    }
+                }
+
+                if (!bignore)
+                {
+                    dotpro = dotpro + stdmineralclr1[i] * stdmineralclr2[i];
+                    d1 = d1 + stdmineralclr1[i] * stdmineralclr1[i];
+                    d2 = d2 + stdmineralclr2[i] * stdmineralclr2[i];
+                }
+            }
+            d1 = System.Math.Sqrt(d1);
+            d2 = System.Math.Sqrt(d2);
+            //            return (0 == d1 || 0 == d2) ? 0 : dotpro / (d1 * d2);
+            // 算法改进, 加上距离权重
+            if (0 == d1 || 0 == d2)
+            {
+                return 0;
+            }
+            double dresult = 0;
+            dresult = (d1 < d2) ? d1 / d2 : d2 / d1;
+            return 0.4 * dotpro / (d1 * d2) + 0.3 * dresult + 0.3 * GetStdEvp(iStartChannel, ref lstIgnoreChannel, stdmineralclr1, stdmineralclr2);
+        }
+        // 获取标准差
+        // 20190903:增加参数iStartChannel哪个位置开始比较, lstIgnoreChannel里面的通道不处理
+        double GetStdEvp(int iStartChannel, ref List<int> lstIgnoreChannel, byte[] stdmineralclr1, byte[] stdmineralclr2)
+        {
+            int iXrayDataLen = stdmineralclr1.Length;
+
+            // 两者数据量不一致,返回0
+            if (iXrayDataLen != stdmineralclr2.Length)
+            {
+                return 0;
+            }
+            if (iStartChannel < 0 || iStartChannel >= iXrayDataLen)
+            {
+                return 1;
+            }
+
+            bool bignore = false;
+            int i = 0;
+            int j = 0;
+            int iSum1 = 0;
+            int iSum2 = 0;
+            double dAva1 = 0;
+            double dAva2 = 0;
+            double dSquare1 = 0;
+            double dSquare2 = 0;
+            List<int> listdata1 = new List<int>();
+            List<int> listdata2 = new List<int>();
+
+            // 求出能谱的平均值
+            for (i = iStartChannel; i < iXrayDataLen; i++)
+            {
+                bignore = false;
+                for (j = 0; j < lstIgnoreChannel.Count(); j++)
+                {
+                    if (lstIgnoreChannel[j] == i)
+                    {
+                        bignore = true;
+                        break;
+                    }
+                }
+
+                if (!bignore)
+                {
+                    iSum1 = iSum1 + (int)stdmineralclr1[i];
+                    listdata1.Add((int)stdmineralclr1[i]);
+
+                    iSum2 = iSum2 + (int)stdmineralclr2[i];
+                    listdata2.Add((int)stdmineralclr2[i]);
+                }
+            }
+
+            dAva1 = iSum1 / listdata1.Count();
+            dAva2 = iSum2 / listdata2.Count();
+
+            for (i = 0; i < listdata1.Count(); i++)
+            {
+                dSquare1 = dSquare1 + (listdata1[i] - dAva1) * (listdata1[i] - dAva1);
+                dSquare2 = dSquare2 + (listdata2[i] - dAva1) * (listdata2[i] - dAva1);
+            }
+            dSquare1 = dSquare1 / listdata1.Count();
+            dSquare2 = dSquare2 / listdata2.Count();
+
+            dSquare1 = System.Math.Sqrt(dSquare1);
+            dSquare2 = System.Math.Sqrt(dSquare2);
+
+            dSquare1 = dSquare1 * (double)iSum2 / iSum1;    // 归一化
+
+            return (dSquare1 < dSquare2) ? (dSquare1 / dSquare2) : (dSquare2 / dSquare1);
+        }
+        #endregion
+
+        private void dgV_IncALib_CellClick(object sender, DataGridViewCellEventArgs e)
+        {
+            if (xrayByteData != null)
+            {
+                dgV_IncALib.ClearSelection();
+                //删除
+                if (e.RowIndex < 0)
+                {
+                    return;
+                }
+
+                //将选择行的数据传递给Xray控件
+                xrayControl.Dr = dt.Rows[e.RowIndex];
+                //xrayControl.Dt = dt;
+                xrayControl.Refresh();
+                //设置选中DataGridView当前行
+                dgV_IncALib.Rows[e.RowIndex].Selected = true;
+            }
+        }
+
+        private void btnCollectXray_Click(object sender, EventArgs e)
+        {
+            try
+            {
+                string strTime = txtCollectTime.Text.Trim();
+                if (txtCollectTime.Equals(""))
+                {
+                    showMessage("Please fill in the collection time name!");
+                    txtCollectTime.Focus();
+                    return;
+                }
+                if (!IsMatch(strTime, 1))
+                {
+                    showMessage("Error collecting time content, the format should be integer!");
+                    txtCollectTime.Focus();
+                    return;
+                }
+                if (Convert.ToInt32(strTime) < 100)
+                {
+                    showMessage("CollectTime must not be less than 100 milliseconds!");
+                    txtCollectTime.Focus();
+                    return;
+                }
+                //获取Xray方法
+                // 电镜设置对象
+                xrayByteData = intToBytes(GetCollectXray(strTime), 0);
+                DataRow dataRow = dt.NewRow();
+                dataRow["SPEC"] = xrayByteData;
+                dataRow["Color"] = 0;
+                xrayContrastControl.Dr = dataRow;
+                xrayContrastControl.Dt = dt;
+                
+                xrayContrastControl.Refresh();
+                //比对
+                GetCompMineralFun(xrayByteData);
+
+                //国际化
+                lan = new Language(this);
+                //国际化后各表头居中显示
+                for (int i = 0; i < dgV_IncALib.Columns.Count; i++)
+                {
+                    dgV_IncALib.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
+                }
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+
+        /// <summary>
+        /// 获取采集当前的Xray信息
+        /// </summary>
+        /// <returns></returns>
+        protected uint[] GetCollectXray(string strTime)
+        {
+            try
+            {
+                if (null == m_cfun)
+                {
+                    //m_cfun = COTSControlFunExport.GetControllerInstance();
+                }
+                if (ConnectionSem(connectionEnumType.EDSOnlyPointXRay))
+                {
+                    if (EDSInit())
+                    {
+                        int iSize = 2000;
+                        uint[] iXrayData = new uint[iSize];
+                        //采集XRay数据
+                        if (m_cfun.CollectSpectrum(uint.Parse(strTime), ref iXrayData))
+                        {
+                            return iXrayData;
+                        }
+                    }
+                }
+                return null;
+            }
+            catch /*(Exception ex)*/
+            {
+                return null;
+            }
+            finally
+            {
+                //EDS过程结束
+                //m_cfun.EDSFinishedInstance();
+
+                //关闭连接
+                DisConnectSem(connectionEnumType.EDSOnlyPointXRay);
+            }
+        }
+
+
+        #region 连接与关闭设备
+        public bool ConnectionSem(connectionEnumType connectionType)
+        {
+            //获取连接电镜类型
+            string connTypeStr = GetConnectionType(connectionType);
+            //连接电镜标识
+            bool bDisConnResult = false;
+            //判断连接状态
+            if (!m_bConnectionState)
+            {
+                //连接电镜设置
+                bDisConnResult = m_cfun.ConncetSem();
+            }
+            if (bDisConnResult)
+            {
+                m_bConnectionState = true;
+            }
+            else
+            {
+                m_bConnectionState = false;
+            }
+            return bDisConnResult;
+        }
+
+        public bool DisConnectSem(connectionEnumType disConnectType)
+        {
+            //获取关闭电镜类型
+            string connTypeStr = GetConnectionType(disConnectType);
+            bool bDisConnResult = false;
+            if (m_bConnectionState)
+            {
+                //bDisConnResult = m_cfun.DisConnectSem();
+            }
+            if (bDisConnResult)
+            {
+                m_bConnectionState = false;
+            }
+            else
+            {
+                m_bConnectionState = true;
+            }
+            return bDisConnResult;
+        }
+
+        private string GetConnectionType(connectionEnumType connectionType)
+        {
+            string connString = string.Empty;
+            switch (connectionType)
+            {
+                //设置单点采集文字内容
+                case connectionEnumType.EDSOnlyPointXRay:
+                    connString = "OnlyPointXRay";
+                    break;
+                //设置多点采集文字内容
+                case connectionEnumType.EDSMultiPointXRay:
+                    connString = "MultiPointXRay";
+                    break;
+                //设置面采集文字内容
+                case connectionEnumType.EDSAreaXRay:
+                    connString = "AreaXRay";
+                    break;
+                //设置图片
+                case connectionEnumType.ScanImage:
+                    connString = "Image";
+                    break;
+                default: break;
+            }
+            return connString;
+        }
+
+        /// <summary>
+        /// EDS初始化
+        /// </summary>
+        public bool EDSInit()
+        {
+            bool bResult = false;
+            //线程调用 加载
+            bResult = m_cfun.EDSInit();
+            return bResult;
+        }
+        public enum connectionEnumType
+        {
+            EDSOnlyPointXRay = 0,
+            EDSMultiPointXRay = 1,
+            EDSAreaXRay = 2,
+            ScanImage = 3
+        }
+        #endregion
+
+        #region int数组转byte数组
+        /// <summary>  
+        /// int数组转byte数组  
+        /// </summary>  
+        /// <param name="src">源int数组</param> 
+        /// <param name="offset">起始位置,一般为0</param>  
+        /// <returns>values</returns>  
+        protected byte[] intToBytes(uint[] src, int offset)
+        {
+            byte[] values = new byte[src.Length * 4];
+            for (int i = 0; i < src.Length; i++)
+            {
+
+                values[offset + 3] = (byte)((src[i] >> 24) & 0xFF);
+                values[offset + 2] = (byte)((src[i] >> 16) & 0xFF);
+                values[offset + 1] = (byte)((src[i] >> 8) & 0xFF);
+                values[offset] = (byte)(src[i] & 0xFF);
+                offset += 4;
+            }
+            return values;
+        }
+
+        protected int[] bytesToInt(byte[] src, int offset)
+        {
+            int[] values = new int[src.Length / 4];
+            for (int i = 0; i < values.Length; i++)
+            {
+                values[i] = BitConverter.ToInt32(src, offset);
+                offset += 4;
+            }
+            return values;
+        }
+        #endregion
+
+        /// <summary>
+        /// 弹出提示
+        /// </summary>
+        /// <param name="strContent"></param>
+        protected void showMessage(string strContent)
+        {
+            MessageBox.Show(strContent, "Tip");
+        }
+
+        #region 常用数据验证的封装,数字字符的验证
+        /// <summary>
+        /// 常用数据验证的封装,数字字符的验证
+        /// </summary>
+        /// <param name="inputVal">需要验证的数值【字符串,或者数字】</param>
+        /// <param name="type">类型为哪一个验证</param>
+        /// <returns>如果验证成功则返回True,否则返回false</returns>
+        public bool IsMatch(string inputVal, int type)
+        {
+            switch (type)
+            {
+                case 0:
+                    return Regex.IsMatch(inputVal, @"^[1-9]d*$");  //匹配正整数
+                case 1:
+                    return Regex.IsMatch(inputVal, @"^-?\d+$");  //匹配整数
+                case 2:
+                    return Regex.IsMatch(inputVal, @"^[A-Za-z0-9]+$");  //匹配由数字和26个英文字母组成的字符串 
+                case 3:
+                    return Regex.IsMatch(inputVal, @"^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$");  //匹配正浮点数
+                case 4:
+                    return Regex.IsMatch(inputVal, @"^[\u4e00-\u9fa5]{0,}$");  //匹配汉字
+                case 5:
+                    return Regex.IsMatch(inputVal, @"^[0-9]+(.[0-9]{1,3})?$");  //匹配1~3位小数的正实数
+                case 6:
+                    return Regex.IsMatch(inputVal, @"^[A-Za-z]+$");  //匹配英文字符
+                default:
+                    return true;
+            }
+        }
+        #endregion
+    }
+}

+ 0 - 3
OTSPartA_STDEditor/UI/Form_MaxEDSRules.resx → SpectrumSTDEditor/UI/XrayContrastForm.resx

@@ -117,7 +117,4 @@
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
-  <metadata name="XmlTreeMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>17, 17</value>
-  </metadata>
 </root>

Some files were not shown because too many files changed in this diff