internal void ApplyProperties(CheckBoxProperties properties) { this.Appearance = properties.Appearance; this.AutoCheck = properties.AutoCheck; this.AutoEllipsis = properties.AutoEllipsis; this.AutoSize = properties.AutoSize; this.CheckAlign = properties.CheckAlign; this.FlatAppearance.BorderColor = properties.FlatAppearanceBorderColor; this.FlatAppearance.BorderSize = properties.FlatAppearanceBorderSize; this.FlatAppearance.CheckedBackColor = properties.FlatAppearanceCheckedBackColor; this.FlatAppearance.MouseDownBackColor = properties.FlatAppearanceMouseDownBackColor; this.FlatAppearance.MouseOverBackColor = properties.FlatAppearanceMouseOverBackColor; this.FlatStyle = properties.FlatStyle; this.ForeColor = properties.ForeColor; this.BackColor = properties.BackColor; this.RightToLeft = properties.RightToLeft; this.TextAlign = properties.TextAlign; this.ThreeState = properties.ThreeState; }
public CheckBoxComboBox() : base() { InitializeComponent(); _CheckBoxProperties = new CheckBoxProperties(); _CheckBoxProperties.PropertyChanged += new EventHandler(_CheckBoxProperties_PropertyChanged); // Dumps the ListControl in a(nother) Container to ensure the ScrollBar on the ListControl does not // Paint over the Size grip. Setting the Padding or Margin on the Popup or host control does // not work as I expected. I don't think it can work that way. CheckBoxComboBoxListControlContainer ContainerControl = new CheckBoxComboBoxListControlContainer(); _CheckBoxComboBoxListControl = new CheckBoxComboBoxListControl(this); _CheckBoxComboBoxListControl.Items.CheckBoxCheckedChanged += Items_CheckBoxCheckedChanged; ContainerControl.Controls.Add(_CheckBoxComboBoxListControl); // This padding spaces neatly on the left-hand side and allows space for the size grip at the bottom. ContainerControl.Padding = new Padding(4, 0, 0, 14); // The ListControl FILLS the ListContainer. _CheckBoxComboBoxListControl.Dock = DockStyle.Fill; // The DropDownControl used by the base class. Will be wrapped in a popup by the base class. DropDownControl = ContainerControl; // Must be set after the DropDownControl is set, since the popup is recreated. // NOTE: I made the dropDown protected so that it can be accessible here. It was private. dropDown.Resizable = true; DropDownControl.BackColor = Color.Black; }