示例#1
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            this.BackColor =
                (this.OurDesigner = this.Enabled ? e.Button == MouseButtons.Left ? this.Normal : this.OurDesigner : this.Disabled).
                    BackColor;

            this.UpdateColor();
        }
示例#2
0
        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);

            /*
             * This makes sure that if the CheckButton is enabled and checked that it preserves its BackColor even when at its
             * normal state hense why we are in the 'OnMouseLeave', although maybe we want it to change and everything to change
             * except the text that way we still get that visual affect...  Hard to determine..
             *
             * I think for now we should actually just preserve the text setting, that way if the other values are changed, we
             * will still know what state we are at.
             */

            /* Only use this if you want to preserve everything that of when in the checked state when leaving the control.
             * If anyone wants this to be implemnted for each other state and don't know how to, just notify me and I will do so.
            this.BackColor =
                (this.OurDesigner =
                 this.Checked && this.Enabled
                     ? this.Clicked.UseBackColor ? this.Clicked : this.Normal
                     : this.Enabled ? this.Normal : this.Disabled).BackColor;
             */

            this.BackColor = (this.OurDesigner = this.Enabled ? this.Normal : this.Disabled).BackColor;

            this.UpdateColor();
        }
示例#3
0
        protected override void OnMouseEnter(EventArgs e)
        {
            base.OnMouseEnter(e);

            this.BackColor = (this.OurDesigner = this.Enabled ? this.Hovered : this.Disabled).BackColor;

            this.UpdateColor();
        }
示例#4
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (!this.Enabled
                || e.Button != MouseButtons.Left) {
                    return;
                }

            this.BackColor = (this.OurDesigner = this.Enabled ? this.Clicked : this.Disabled).BackColor;

            this.UpdateColor();
        }
示例#5
0
        protected override void OnEnabledChanged(EventArgs e)
        {
            base.OnEnabledChanged(e);

            if (this.Enabled)
            {
                this.BackColor = (this.OurDesigner = this._previousDesigner).UseBackColor
                                     ? this.OurDesigner.BackColor
                                     : this.Normal.BackColor;

                this.UpdateColor();
                return;
            }

            this._previousDesigner = this.OurDesigner;
            this.BackColor = (this.OurDesigner = this.Disabled).BackColor;
            this.UpdateColor();

            ////this.BackColor = !this.Enabled = (this._previousDesigner = this.OurDesigner)

            /* Doing it this way may not keep the state it was at previous when enabled. */
            ////this.BackColor = (this.OurDesigner = this.Enabled ? this.Normal : this.Disabled).BackColor;

            ////this.BackColor = this.Enabled
            ////                 ? this.OurDesigner.UseBackColor ? this.OurDesigner.BackColor : this.Normal.BackColor
            ////             : this.Disabled.BackColor;

            ////this.UpdateColor();
        }
示例#6
0
        protected OurCheckButtonBase()
        {
            base.DoubleBuffered = true;

            this.Padding = new Padding(6, 2, 6, 2);

            this._previousDesigner = this.OurDesigner = this.Normal = new OurCheckButtonNormal(this);

            this.Hovered = new OurCheckButtonHovered(this);
            this.Clicked = new OurCheckButtonClicked(this);
            this.Disabled = new OurCheckButtonDisabled(this);
            base.Text = this.Normal.Text = "ourCheckButton1";
            base.MinimumSize = new Size(1, 1);
        }