protected override ButtonBaseAdapter.LayoutOptions Layout(PaintEventArgs e)
 {
     ButtonBaseAdapter.LayoutOptions options = this.CommonLayout();
     options.checkSize    = (int)(12f * CheckableControlBaseAdapter.GetDpiScaleRatio(e.Graphics));
     options.shadowedText = false;
     return(options);
 }
        protected void DrawCheckBackgroundFlat(PaintEventArgs e, Rectangle bounds, Color borderColor, Color checkBackground, bool disabledColors)
        {
            Color control             = checkBackground;
            Color contrastControlDark = borderColor;

            if (!this.Control.Enabled && disabledColors)
            {
                contrastControlDark = ControlPaint.ContrastControlDark;
                control             = SystemColors.Control;
            }
            float dpiScaleRatio = CheckableControlBaseAdapter.GetDpiScaleRatio(e.Graphics);

            using (WindowsGraphics graphics = WindowsGraphics.FromGraphics(e.Graphics))
            {
                using (WindowsPen pen = new WindowsPen(graphics.DeviceContext, contrastControlDark))
                {
                    using (WindowsBrush brush = new WindowsSolidBrush(graphics.DeviceContext, control))
                    {
                        if (dpiScaleRatio > 1.1)
                        {
                            bounds.Width--;
                            bounds.Height--;
                            graphics.DrawAndFillEllipse(pen, brush, bounds);
                            bounds.Inflate(-1, -1);
                        }
                        else
                        {
                            DrawAndFillEllipse(graphics, pen, brush, bounds);
                        }
                    }
                }
            }
        }
Beispiel #3
0
 internal static ButtonBaseAdapter.LayoutOptions PaintPopupLayout(Graphics g, bool show3D, int checkSize, Rectangle clientRectangle, Padding padding, bool isDefault, Font font, string text, bool enabled, ContentAlignment textAlign, RightToLeft rtl)
 {
     ButtonBaseAdapter.LayoutOptions options = ButtonBaseAdapter.CommonLayout(clientRectangle, padding, isDefault, font, text, enabled, textAlign, rtl);
     options.shadowedText = false;
     if (show3D)
     {
         options.checkSize = (int)((checkSize * CheckableControlBaseAdapter.GetDpiScaleRatio(g)) + 1f);
         return(options);
     }
     options.checkSize        = (int)(checkSize * CheckableControlBaseAdapter.GetDpiScaleRatio(g));
     options.checkPaddingSize = 1;
     return(options);
 }
Beispiel #4
0
 private ButtonBaseAdapter.LayoutOptions PaintPopupLayout(PaintEventArgs e, bool show3D)
 {
     ButtonBaseAdapter.LayoutOptions options = this.CommonLayout();
     options.shadowedText = false;
     if (show3D)
     {
         options.checkSize = (int)((11f * CheckableControlBaseAdapter.GetDpiScaleRatio(e.Graphics)) + 1f);
         return(options);
     }
     options.checkSize        = (int)(11f * CheckableControlBaseAdapter.GetDpiScaleRatio(e.Graphics));
     options.checkPaddingSize = 1;
     return(options);
 }
Beispiel #5
0
 protected override ButtonBaseAdapter.LayoutOptions Layout(PaintEventArgs e)
 {
     ButtonBaseAdapter.LayoutOptions options = this.CommonLayout();
     options.hintTextUp          = false;
     options.everettButtonCompat = !Application.RenderWithVisualStyles;
     if (Application.RenderWithVisualStyles)
     {
         using (Graphics graphics = WindowsFormsUtils.CreateMeasurementGraphics())
         {
             options.checkSize = RadioButtonRenderer.GetGlyphSize(graphics, RadioButtonRenderer.ConvertFromButtonState(base.GetState(), base.Control.MouseIsOver)).Width;
             return(options);
         }
     }
     options.checkSize = (int)(options.checkSize * CheckableControlBaseAdapter.GetDpiScaleRatio(e.Graphics));
     return(options);
 }
 protected void DrawCheckOnly(PaintEventArgs e, ButtonBaseAdapter.LayoutData layout, Color checkColor, Color checkBackground, bool disabledColors)
 {
     if (this.Control.Checked)
     {
         if (!this.Control.Enabled && disabledColors)
         {
             checkColor = SystemColors.ControlDark;
         }
         float dpiScaleRatio = CheckableControlBaseAdapter.GetDpiScaleRatio(e.Graphics);
         using (WindowsGraphics graphics = WindowsGraphics.FromGraphics(e.Graphics))
         {
             using (WindowsBrush brush = new WindowsSolidBrush(graphics.DeviceContext, checkColor))
             {
                 int       n    = 5;
                 Rectangle rect = new Rectangle(layout.checkBounds.X + GetScaledNumber(n, dpiScaleRatio), layout.checkBounds.Y + GetScaledNumber(n - 1, dpiScaleRatio), GetScaledNumber(2, dpiScaleRatio), GetScaledNumber(4, dpiScaleRatio));
                 graphics.FillRectangle(brush, rect);
                 Rectangle rectangle2 = new Rectangle(layout.checkBounds.X + GetScaledNumber(n - 1, dpiScaleRatio), layout.checkBounds.Y + GetScaledNumber(n, dpiScaleRatio), GetScaledNumber(4, dpiScaleRatio), GetScaledNumber(2, dpiScaleRatio));
                 graphics.FillRectangle(brush, rectangle2);
             }
         }
     }
 }