コード例 #1
0
 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.RightToLeft = properties.RightToLeft;
     this.TextAlign   = properties.TextAlign;
     this.ThreeState  = properties.ThreeState;
 }
コード例 #2
0
        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 DropDownStrip 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 += new EventHandler(ItemsCheckBoxCheckedChanged);
            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;
        }