private void lstStyles_SelectedIndexChanged(object sender, EventArgs e) { btnDelete.Enabled = false; var style = lstStyles.SelectedItem as ICompositeTypeStyle; if (style != null) { btnDelete.Enabled = true; if (!_controls.ContainsKey(style)) { _controls[style] = new ConditionListButtons(); _controls[style].Owner = this.Owner; _controls[style].Factory = this.Factory; _controls[style].SetItem(_parent, style); if (style.RuleCount == 0) { _controls[style].AddRule(); } } //Update offset if (lstStyles.SelectedIndex >= 0) { int offset = 0; for (int i = 0; i < lstStyles.SelectedIndex; i++) { var cs = (ICompositeTypeStyle)lstStyles.Items[i]; offset += cs.RuleCount; } _controls[style].SetThemeOffset(offset); } SetActiveControl(_controls[style]); } }
private void SetActiveControl(ConditionListButtons conditionListButtons) { splitContainer1.Panel2.Controls.Clear(); conditionListButtons.Dock = DockStyle.Fill; splitContainer1.Panel2.Controls.Add(conditionListButtons); }
private void lstStyles_SelectedIndexChanged(object sender, EventArgs e) { btnDelete.Enabled = false; var style = lstStyles.SelectedItem as ICompositeTypeStyle; if (style != null) { btnDelete.Enabled = true; if (!_controls.ContainsKey(style)) { _controls[style] = new ConditionListButtons(); _controls[style].Owner = this.Owner; _controls[style].Factory = this.Factory; _controls[style].SetItem(_parent, style); if (style.RuleCount == 0) _controls[style].AddRule(); } SetActiveControl(_controls[style]); } }