private void RemoveComboBoxGroup(int comboBoxGroupId) { ComboBoxGroupUserControl comboBoxGroupUserControlToRemove = new ComboBoxGroupUserControl(); foreach (Control control in flowLayoutPanel1.Controls) { if (control is ComboBoxGroupUserControl) { ComboBoxGroupUserControl comboBoxGroupUserControl = (ComboBoxGroupUserControl)control; if (comboBoxGroupUserControl.Name == string.Format("comboBoxGroupUserControl{0}", comboBoxGroupId)) { comboBoxGroupUserControlToRemove = comboBoxGroupUserControl; _comboBoxGroups.Remove(comboBoxGroupUserControl); break; } } } flowLayoutPanel1.Controls.Remove(comboBoxGroupUserControlToRemove); comboBoxGroupUserControlToRemove.Dispose(); if (comboBoxGroupId == 2) { removeButton.Enabled = false; } }
private void AddGroup() { int numberOfGroups = _comboBoxGroups.Count; ComboBoxGroupUserControl newComboBoxGroupUserControl = new ComboBoxGroupUserControl(); newComboBoxGroupUserControl.InitializeNotFirst(); newComboBoxGroupUserControl.TabIndex = 9 + numberOfGroups; newComboBoxGroupUserControl.Name = string.Format("comboBoxGroupUserControl{0}", numberOfGroups + 1); flowLayoutPanel1.Controls.Add(newComboBoxGroupUserControl); InitializeParanthesBeginComboBoxe(newComboBoxGroupUserControl.GetParanthesBeginComboBox()); InitializeParanthesEndComboBoxe(newComboBoxGroupUserControl.GetParanthesEndComboBox()); InitializeAndOrComboBox(newComboBoxGroupUserControl.GetAndOrComboBox()); InitializeColumnComboBox(newComboBoxGroupUserControl.GetColumnComboBox()); InitializeOperatorComboBox(newComboBoxGroupUserControl.GetOperatorComboBox()); InitializeToolTip(newComboBoxGroupUserControl.GetValueComboBox(), _searchBoxToolTipText); newComboBoxGroupUserControl.GetColumnComboBox().SelectedIndexChanged += ColumnComboBox_SelectedIndexChanged; newComboBoxGroupUserControl.GetValueComboBox().KeyDown += ValueComboBox_KeyDown; newComboBoxGroupUserControl.GetEnabledCheckBox().CheckedChanged += EnabledCheckBox1_CheckedChanged; newComboBoxGroupUserControl.ReloadValuesCheckBoxChangedEvent += ComboBoxGroup_ReloadValuesCheckBoxChangedEvent; _comboBoxGroups.Add(newComboBoxGroupUserControl); flowLayoutPanel1.ScrollControlIntoView(newComboBoxGroupUserControl); removeButton.Enabled = true; }
private void ComboBoxGroup_ReloadValuesCheckBoxChangedEvent(object sender) { ComboBoxGroupUserControl comboBoxGroupUserControl = (ComboBoxGroupUserControl)sender; ComboBox columnComboBox = comboBoxGroupUserControl.GetColumnComboBox(); InitializeValueComboBox(columnComboBox); }
private void ScrollFirstGroupIntoView() { flowLayoutPanel1.PerformLayout(); ComboBoxGroupUserControl firstComboBoxGroupUserControl = _comboBoxGroups[0]; flowLayoutPanel1.ScrollControlIntoView(firstComboBoxGroupUserControl); }
private static void EnabledCheckBoxChanged(CheckBox checkBox) { ComboBoxGroupUserControl comboBoxGroupUserControl = (ComboBoxGroupUserControl)checkBox.Parent; comboBoxGroupUserControl.GetAndOrComboBox().Enabled = checkBox.Checked; comboBoxGroupUserControl.GetColumnComboBox().Enabled = checkBox.Checked; comboBoxGroupUserControl.GetParanthesBeginComboBox().Enabled = checkBox.Checked; comboBoxGroupUserControl.GetParanthesEndComboBox().Enabled = checkBox.Checked; if (comboBoxGroupUserControl.GetColumnComboBox().SelectedIndex > 0) { comboBoxGroupUserControl.GetOperatorComboBox().Enabled = checkBox.Checked; comboBoxGroupUserControl.GetValueComboBox().Enabled = checkBox.Checked; } }