コード例 #1
0
 internal override void PaintUp(PaintEventArgs e, CheckState state)
 {
     if (base.Control.Appearance == Appearance.Button)
     {
         new ButtonPopupAdapter(base.Control).PaintUp(e, base.Control.CheckState);
     }
     else
     {
         Graphics graphics = e.Graphics;
         ButtonBaseAdapter.ColorData  colors = base.PaintPopupRender(e.Graphics).Calculate();
         ButtonBaseAdapter.LayoutData layout = this.PaintPopupLayout(e, false).Layout();
         Region clip = e.Graphics.Clip;
         base.PaintButtonBackground(e, base.Control.ClientRectangle, null);
         base.PaintImage(e, layout);
         base.DrawCheckBackground(e, layout.checkBounds, colors.windowText, colors.options.highContrast ? colors.buttonFace : colors.highlight, true, colors);
         ButtonBaseAdapter.DrawFlatBorder(e.Graphics, layout.checkBounds, colors.buttonShadow);
         base.DrawCheckOnly(e, layout, colors, colors.windowText, colors.highlight, true);
         base.PaintField(e, layout, colors, colors.windowText, true);
     }
 }
コード例 #2
0
        internal override void PaintUp(PaintEventArgs e, CheckState state)
        {
            ButtonBaseAdapter.ColorData  colors = base.PaintPopupRender(e.Graphics).Calculate();
            ButtonBaseAdapter.LayoutData layout = this.PaintPopupLayout(e, state == CheckState.Unchecked, 1).Layout();
            Graphics  g = e.Graphics;
            Rectangle clientRectangle = base.Control.ClientRectangle;
            Brush     background      = null;

            if (state == CheckState.Indeterminate)
            {
                background = ButtonBaseAdapter.CreateDitherBrush(colors.highlight, colors.buttonFace);
            }
            try
            {
                base.PaintButtonBackground(e, clientRectangle, background);
            }
            finally
            {
                if (background != null)
                {
                    background.Dispose();
                    background = null;
                }
            }
            if (base.Control.IsDefault)
            {
                clientRectangle.Inflate(-1, -1);
            }
            base.PaintImage(e, layout);
            base.PaintField(e, layout, colors, colors.windowText, true);
            ButtonBaseAdapter.DrawDefaultBorder(g, clientRectangle, colors.options.highContrast ? colors.windowText : colors.buttonShadow, base.Control.IsDefault);
            if (state == CheckState.Unchecked)
            {
                ButtonBaseAdapter.DrawFlatBorder(g, clientRectangle, colors.options.highContrast ? colors.windowText : colors.buttonShadow);
            }
            else
            {
                ButtonBaseAdapter.Draw3DLiteBorder(g, clientRectangle, colors, false);
            }
        }
コード例 #3
0
        internal override void PaintDown(PaintEventArgs e, CheckState state)
        {
            bool flag = (base.Control.FlatAppearance.BorderSize != 1) || !base.Control.FlatAppearance.BorderColor.IsEmpty;

            ButtonBaseAdapter.ColorData  colors = base.PaintFlatRender(e.Graphics).Calculate();
            ButtonBaseAdapter.LayoutData layout = this.PaintFlatLayout(e, !base.Control.FlatAppearance.CheckedBackColor.IsEmpty || (SystemInformation.HighContrast ? (state != CheckState.Indeterminate) : (state == CheckState.Unchecked)), (!flag && SystemInformation.HighContrast) && (state == CheckState.Checked), base.Control.FlatAppearance.BorderSize).Layout();
            if (!base.Control.FlatAppearance.BorderColor.IsEmpty)
            {
                colors.windowFrame = base.Control.FlatAppearance.BorderColor;
            }
            Graphics  g = e.Graphics;
            Rectangle clientRectangle = base.Control.ClientRectangle;
            Color     backColor       = base.Control.BackColor;

            if (!base.Control.FlatAppearance.MouseDownBackColor.IsEmpty)
            {
                backColor = base.Control.FlatAppearance.MouseDownBackColor;
            }
            else
            {
                switch (state)
                {
                case CheckState.Unchecked:
                case CheckState.Checked:
                    backColor = colors.options.highContrast ? colors.buttonShadow : colors.lowHighlight;
                    break;

                case CheckState.Indeterminate:
                    backColor = ButtonBaseAdapter.MixedColor(colors.options.highContrast ? colors.buttonShadow : colors.lowHighlight, colors.buttonFace);
                    break;
                }
            }
            this.PaintBackground(e, clientRectangle, backColor);
            if (base.Control.IsDefault)
            {
                clientRectangle.Inflate(-1, -1);
            }
            base.PaintImage(e, layout);
            base.PaintField(e, layout, colors, colors.windowText, false);
            if (base.Control.Focused && base.Control.ShowFocusCues)
            {
                ButtonBaseAdapter.DrawFlatFocus(g, layout.focus, colors.options.highContrast ? colors.windowText : colors.constrastButtonShadow);
            }
            if ((!base.Control.IsDefault || !base.Control.Focused) || (base.Control.FlatAppearance.BorderSize != 0))
            {
                ButtonBaseAdapter.DrawDefaultBorder(g, clientRectangle, colors.windowFrame, base.Control.IsDefault);
            }
            if (flag)
            {
                if (base.Control.FlatAppearance.BorderSize != 1)
                {
                    ButtonBaseAdapter.DrawFlatBorderWithSize(g, clientRectangle, colors.windowFrame, base.Control.FlatAppearance.BorderSize);
                }
                else
                {
                    ButtonBaseAdapter.DrawFlatBorder(g, clientRectangle, colors.windowFrame);
                }
            }
            else if ((state == CheckState.Checked) && SystemInformation.HighContrast)
            {
                ButtonBaseAdapter.DrawFlatBorder(g, clientRectangle, colors.windowFrame);
                ButtonBaseAdapter.DrawFlatBorder(g, clientRectangle, colors.buttonShadow);
            }
            else if (state == CheckState.Indeterminate)
            {
                ButtonBaseAdapter.Draw3DLiteBorder(g, clientRectangle, colors, false);
            }
            else
            {
                ButtonBaseAdapter.DrawFlatBorder(g, clientRectangle, colors.windowFrame);
            }
        }