internal override void PaintUp(PaintEventArgs e, CheckState state)
        {
            if (Control.Appearance == Appearance.Button)
            {
                ButtonAdapter.PaintUp(e, Control.Checked ? CheckState.Checked : CheckState.Unchecked);
            }
            else
            {
                ColorData  colors = PaintRender(e.Graphics).Calculate();
                LayoutData layout = Layout(e).Layout();
                PaintButtonBackground(e, Control.ClientRectangle, null);

                PaintImage(e, layout);
                DrawCheckBox(e, layout);
                PaintField(e, layout, colors, colors.windowText, true);
            }
        }
        internal override void PaintUp(PaintEventArgs e, CheckState state)
        {
            if (Control.Appearance == Appearance.Button)
            {
                ButtonAdapter.PaintUp(e, Control.CheckState);
            }
            else
            {
                ColorData  colors = PaintRender(e).Calculate();
                LayoutData layout = Layout(e).Layout();
                PaintButtonBackground(e, Control.ClientRectangle, null);

                if (!layout.Options.DotNetOneButtonCompat)
                {
                    layout.TextBounds.Offset(-1, -1);
                }

                layout.ImageBounds.Offset(-1, -1);

                AdjustFocusRectangle(layout);

                if (!string.IsNullOrEmpty(Control.Text))
                {
                    //minor adjustment to make sure the appearance is exactly the same as Win32 app.
                    int focusRectFixup = layout.Focus.X & 0x1; // if it's odd, subtract one pixel for fixup.
                    if (!Application.RenderWithVisualStyles)
                    {
                        focusRectFixup = 1 - focusRectFixup;
                    }

                    layout.Focus.Offset(-(focusRectFixup + 1), -2);
                    layout.Focus.Width = layout.TextBounds.Width + layout.ImageBounds.Width - 1;
                    layout.Focus.Intersect(layout.TextBounds);

                    if (layout.Options.TextAlign != LayoutUtils.AnyLeft && layout.Options.UseCompatibleTextRendering && layout.Options.Font.Italic)
                    {
                        // fixup for GDI+ text rendering.
                        layout.Focus.Width += 2;
                    }
                }

                PaintImage(e, layout);
                DrawCheckBox(e, layout);
                PaintField(e, layout, colors, colors.WindowText, true);
            }
        }
Exemple #3
0
        internal override void PaintUp(PaintEventArgs e, CheckState state)
        {
            if (Control.Appearance == Appearance.Button)
            {
                ButtonAdapter.PaintUp(e, Control.CheckState);
                return;
            }

            ColorData colors = PaintFlatRender(e).Calculate();

            if (Control.Enabled)
            {
                PaintFlatWorker(e, colors.windowText, colors.highlight, colors.windowFrame, colors);
            }
            else
            {
                PaintFlatWorker(e, colors.buttonShadow, colors.buttonFace, colors.buttonShadow, colors);
            }
        }