|
@@ -684,7 +684,96 @@ namespace OTSPartA_STDEditor
|
|
|
|
|
|
private void textbox_STDEditor_MouseLeave(object sender, EventArgs e)
|
|
|
{
|
|
|
+ dataGridView_KeyElements.Rows.Clear();
|
|
|
+ dataGridView_KeyElements.Columns.Clear();
|
|
|
|
|
|
+
|
|
|
+ string str_RemoveBlank = textbox_STDEditor.Text.ToString().Replace(" ", "");
|
|
|
+ str_RemoveBlank = str_RemoveBlank.Replace("\r\n", "");
|
|
|
+ str_RemoveBlank = str_RemoveBlank.Replace("forth_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> UsingElementL = new List<string>();
|
|
|
+ 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]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<string> SubElements = new List<string>();
|
|
|
+ for (int i = 0; i < dataGridView_SubElements.ColumnCount; i++)
|
|
|
+ {
|
|
|
+ if (UsingElementL.Contains(dataGridView_SubElements.Rows[0].Cells[i].Value))
|
|
|
+ {
|
|
|
+ SubElements.Add(dataGridView_SubElements.Rows[0].Cells[i].Value.ToString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ dataGridView_SubElements.Rows.Clear();
|
|
|
+ dataGridView_SubElements.Columns.Clear();
|
|
|
+
|
|
|
+ for (int i = 0; i < SubElements.Count; i++)
|
|
|
+ {
|
|
|
+ DataGridViewButtonColumn dataGridViewButtonColumn = new DataGridViewButtonColumn();
|
|
|
+ dataGridViewButtonColumn.Name = dataGridView_SubElements.Columns.Count.ToString();
|
|
|
+ dataGridView_SubElements.Columns.Add(dataGridViewButtonColumn);
|
|
|
+ if (dataGridView_SubElements.Rows.Count == 0)
|
|
|
+ {
|
|
|
+ DataGridViewRow row = new DataGridViewRow();
|
|
|
+ dataGridView_SubElements.Rows.Add(row);
|
|
|
+ }
|
|
|
+ dataGridView_SubElements.Rows[0].Cells[dataGridView_SubElements.ColumnCount - 1].Value = SubElements[i];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (SubElements.Count > 0)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < UsingElementL.Count; i++)
|
|
|
+ {
|
|
|
+ if (!SubElements.Contains(UsingElementL[i]))
|
|
|
+ {
|
|
|
+ DataGridViewButtonColumn dataGridViewButtonColumn = new DataGridViewButtonColumn();
|
|
|
+ dataGridViewButtonColumn.Name = dataGridView_KeyElements.Columns.Count.ToString();
|
|
|
+ dataGridView_KeyElements.Columns.Add(dataGridViewButtonColumn);
|
|
|
+ if (dataGridView_KeyElements.Rows.Count == 0)
|
|
|
+ {
|
|
|
+ DataGridViewRow row = new DataGridViewRow();
|
|
|
+ dataGridView_KeyElements.Rows.Add(row);
|
|
|
+ }
|
|
|
+ dataGridView_KeyElements.Rows[0].Cells[dataGridView_KeyElements.ColumnCount - 1].Value = UsingElementL[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for (int i = 0; i < UsingElementL.Count; i++)
|
|
|
+ {
|
|
|
+ DataGridViewButtonColumn dataGridViewButtonColumn = new DataGridViewButtonColumn();
|
|
|
+ dataGridViewButtonColumn.Name = dataGridView_KeyElements.Columns.Count.ToString();
|
|
|
+ dataGridView_KeyElements.Columns.Add(dataGridViewButtonColumn);
|
|
|
+ if (dataGridView_KeyElements.Rows.Count == 0)
|
|
|
+ {
|
|
|
+ DataGridViewRow row = new DataGridViewRow();
|
|
|
+ dataGridView_KeyElements.Rows.Add(row);
|
|
|
+ }
|
|
|
+ dataGridView_KeyElements.Rows[0].Cells[i].Value = UsingElementL[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dataGridView_KeyElements.ClearSelection();
|
|
|
+ dataGridView_SubElements.ClearSelection();
|
|
|
}
|
|
|
|
|
|
public void ShowTabXray()
|