示例#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;
 }
示例#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 PopupDropDown protected so that it can be accessible here. It was private.
            PopupDropDown.Resizable = true;
        }