Bladeren bron

回溯标准库版本

cxs 1 jaar geleden
bovenliggende
commit
3fd723af66

BIN
Bin/x64/Debug/Config/SysData/Cleanness_F.db


+ 36 - 0
OTSPartA_STDEditor/OTSPartA_STDEditor.csproj

@@ -229,6 +229,12 @@
     <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>
@@ -253,6 +259,24 @@
     <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>
@@ -287,6 +311,9 @@
     <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>
@@ -299,6 +326,15 @@
     <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>

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

@@ -0,0 +1,157 @@
+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;
+    }
+}

+ 552 - 0
OTSPartA_STDEditor/UI/Form_GroupId.cs

@@ -0,0 +1,552 @@
+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;
+                }
+                
+            }
+        }
+    }
+}

+ 123 - 0
OTSPartA_STDEditor/UI/Form_GroupId.resx

@@ -0,0 +1,123 @@
+<?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>

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

@@ -0,0 +1,696 @@
+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;
+    }
+}

+ 1406 - 0
OTSPartA_STDEditor/UI/Form_MaxEDSRules.cs

@@ -0,0 +1,1406 @@
+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();
+            }
+        }
+    }
+}

+ 123 - 0
OTSPartA_STDEditor/UI/Form_MaxEDSRules.resx

@@ -0,0 +1,123 @@
+<?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>

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

@@ -0,0 +1,353 @@
+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;
+    }
+}

+ 544 - 0
OTSPartA_STDEditor/UI/Form_UserConstants.cs

@@ -0,0 +1,544 @@
+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
+    }
+}
+
+

+ 120 - 0
OTSPartA_STDEditor/UI/Form_UserConstants.resx

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

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

@@ -0,0 +1,655 @@
+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;
+    }
+}

+ 1424 - 0
OTSPartA_STDEditor/UI/Form_ZeroElementRules.cs

@@ -0,0 +1,1424 @@
+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();
+            }
+        }
+    }
+}

+ 123 - 0
OTSPartA_STDEditor/UI/Form_ZeroElementRules.resx

@@ -0,0 +1,123 @@
+<?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>

+ 1 - 1
SpectrumSTDEditor/UI/Form_Main.Designer.cs

@@ -555,7 +555,7 @@
             this.Name = "Form_Main";
             this.ShowIcon = false;
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
-            this.Text = "表达式编辑器";
+            this.Text = "谱峰标准库浏览器";
             this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_ConstantsEditor2_FormClosing);
             this.Load += new System.EventHandler(this.Form_Main_Load);

+ 20 - 20
SpectrumSTDEditor/UI/Form_Main.resx

@@ -121,121 +121,121 @@
   <data name="ribbonOrbMenuItem_Convert.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wQAADsEBuJFr7QAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/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=
+        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonOrbRecentItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        vwAADr8BOAVTJAAAABpJREFUWEftwQEBAAAAgiD/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
-        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        vwAADr8BOAVTJAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonOrbOptionButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        vwAADr8BOAVTJAAAABpJREFUWEftwQEBAAAAgiD/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
-        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        vwAADr8BOAVTJAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonOrbMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        vwAADr8BOAVTJAAAABpJREFUWEftwQEBAAAAgiD/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
-        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        vwAADr8BOAVTJAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonDescriptionMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        vwAADr8BOAVTJAAAABpJREFUWEftwQEBAAAAgiD/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
-        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        vwAADr8BOAVTJAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonColorChooser1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        vwAADr8BOAVTJAAAABpJREFUWEftwQEBAAAAgiD/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
-        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        vwAADr8BOAVTJAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonOrbMenuItem2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        vwAADr8BOAVTJAAAABpJREFUWEftwQEBAAAAgiD/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
-        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        vwAADr8BOAVTJAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        vwAADr8BOAVTJAAAABpJREFUWEftwQEBAAAAgiD/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
-        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        vwAADr8BOAVTJAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonButton2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        vwAADr8BOAVTJAAAABpJREFUWEftwQEBAAAAgiD/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
-        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        vwAADr8BOAVTJAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonButton3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        wAAADsABataJCQAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+        vwAADr8BOAVTJAAAABpJREFUWEftwQEBAAAAgiD/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
-        wAAADsABataJCQAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+        vwAADr8BOAVTJAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
 </root>

+ 1 - 1
SpectrumSTDEditor/UI/STDRuleslist.cs

@@ -75,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 = shareFunction.string10ToColor(shareFunction.ObtainRandomColor());
+                view.BackColor = shareFunction.string10ToColor(kv.Value.Color);
                 Grid_Minerals[i, 1].View = view;
                 i++;
             }