private void DeleteNewRuleB_Click(object sender, EventArgs e) { AddPanel.Hide(); RuleTextTB.Clear(); //RuleOrTextPanel.Show(); foreach (Button a in positionsList) { if (a.Location == AddPanel.Location) { a.Enabled = true; a.Show(); } } }
private void SaveNewRuleB_Click(object sender, EventArgs e) { if (RuleTextTB.Text.Length < 2) { return; } if (newTreeFlag == true) { AddPanel.Hide(); mainTree.Text = RuleTextTB.Text; mainTree.IsActive = true; TableLayoutPanel zero = new RuleTextPanelPreset(RuleTextTB.Text, "button0").Table; this.Controls.Add(zero); Button zeroLoc = sender as Button; zero.Location = zeroLoc.Parent.Parent.Location; RuleTextTB.Clear(); positionsList[1].Enabled = true; positionsList[2].Enabled = true; CreateTextB.Enabled = true; DeleteNewRuleB.Enabled = true; newTreeFlag = false; return; } AddPanel.Hide(); Tree cell = mainTree.FindName(mainTree, clicked); cell.Text = RuleTextTB.Text; cell.IsActive = true; RuleTextTB.Clear(); TableLayoutPanel tlp = new RuleTextPanelPreset(cell.Text, cell.Id).Table; this.Controls.Add(tlp); Button bLoc = sender as Button; tlp.Location = bLoc.Parent.Parent.Location; if (clauseFlag == true) { } if (clauseFlag == false) { tlp.BackColor = SystemColors.GradientActiveCaption; tlp.GetControlFromPosition(0, 1).BackColor = SystemColors.GradientActiveCaption; cell.IsClause = false; } if (cell.Prev.IsClause) { foreach (Button a in positionsList) { if (cell.Left != null) { if (a.Name == cell.Left.Id) { a.Enabled = true; } } if (cell.Right != null) { if (a.Name == cell.Right.Id) { a.Enabled = true; } } } } if (!cell.Prev.IsClause) { foreach (Button a in positionsList) { if (a.Name == cell.Left.Id || a.Name == cell.Right.Id) { a.Enabled = true; } } if (cell.Prev.Left.Id == cell.Id) { foreach (Button a2 in positionsList) { if (cell.Prev.Right.Id == a2.Name) { a2.Enabled = false; } } } else { foreach (Button a2 in positionsList) { if (cell.Prev.Left.Id == a2.Name) { a2.Enabled = false; } } } } alreadyClicked = false; }