private void RemoveComboBoxGroup(int comboBoxGroupId) { ComboBoxGroupStatisticsUserControl comboBoxGroupUserControlToRemove = new ComboBoxGroupStatisticsUserControl(); foreach (Control control in flowLayoutPanel1.Controls) { if (control is ComboBoxGroupStatisticsUserControl) { ComboBoxGroupStatisticsUserControl comboBoxGroupUserControl = (ComboBoxGroupStatisticsUserControl)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; ComboBoxGroupStatisticsUserControl newComboBoxGroupUserControl = new ComboBoxGroupStatisticsUserControl(); newComboBoxGroupUserControl.InitializeNotFirst(); newComboBoxGroupUserControl.TabIndex = 3 + numberOfGroups; newComboBoxGroupUserControl.Name = string.Format("comboBoxGroupUserControl{0}", numberOfGroups + 1); flowLayoutPanel1.Controls.Add(newComboBoxGroupUserControl); InitializeColumnComboBox(newComboBoxGroupUserControl.GetColumnComboBox()); newComboBoxGroupUserControl.GetColumnComboBox().SelectedIndexChanged += ColumnComboBox_SelectedIndexChanged; newComboBoxGroupUserControl.GetEnabledCheckBox().CheckedChanged += EnabledCheckBox1_CheckedChanged; _comboBoxGroups.Add(newComboBoxGroupUserControl); flowLayoutPanel1.ScrollControlIntoView(newComboBoxGroupUserControl); removeButton.Enabled = true; SetViewButton(); }
private void ScrollFirstGroupIntoView() { flowLayoutPanel1.PerformLayout(); ComboBoxGroupStatisticsUserControl firstComboBoxGroupUserControl = _comboBoxGroups[0]; flowLayoutPanel1.ScrollControlIntoView(firstComboBoxGroupUserControl); }
private void EnabledCheckBoxChanged(CheckBox checkBox) { ComboBoxGroupStatisticsUserControl comboBoxGroupUserControl = (ComboBoxGroupStatisticsUserControl)checkBox.Parent; comboBoxGroupUserControl.GetColumnComboBox().Enabled = checkBox.Checked; SetViewButton(); }