Beispiel #1
0
 internal void ApplyProperties(CheckBoxProperties properties)
 {
     Appearance   = properties.Appearance;
     AutoCheck    = properties.AutoCheck;
     AutoEllipsis = properties.AutoEllipsis;
     AutoSize     = properties.AutoSize;
     CheckAlign   = properties.CheckAlign;
     FlatAppearance.BorderColor        = properties.FlatAppearanceBorderColor;
     FlatAppearance.BorderSize         = properties.FlatAppearanceBorderSize;
     FlatAppearance.CheckedBackColor   = properties.FlatAppearanceCheckedBackColor;
     FlatAppearance.MouseDownBackColor = properties.FlatAppearanceMouseDownBackColor;
     FlatAppearance.MouseOverBackColor = properties.FlatAppearanceMouseOverBackColor;
     FlatStyle   = properties.FlatStyle;
     ForeColor   = properties.ForeColor;
     RightToLeft = properties.RightToLeft;
     TextAlign   = properties.TextAlign;
     ThreeState  = properties.ThreeState;
 }
Beispiel #2
0
        public CheckBoxComboBox()
        {
            InitializeComponent();
            _CheckBoxProperties = new CheckBoxProperties();
            _CheckBoxProperties.PropertyChanged += _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.
            var 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;
        }