Ejemplo n.º 1
0
        protected void DrawCheckBox(PaintEventArgs e, LayoutData layout)
        {
            Rectangle check = layout.checkBounds;

            if (!Application.RenderWithVisualStyles)
            {
                check.X--;      // compensate for Windows drawing slightly offset to right
            }

            ButtonState style = GetState();

            if (Application.RenderWithVisualStyles)
            {
                using var hdc = new DeviceContextHdcScope(e);
                RadioButtonRenderer.DrawRadioButtonWithVisualStyles(
                    hdc,
                    new Point(check.Left, check.Top),
                    RadioButtonRenderer.ConvertFromButtonState(style, Control.MouseIsOver),
                    Control.HandleInternal);
            }
            else
            {
                ControlPaint.DrawRadioButton(e.GraphicsInternal, check, style);
            }
        }
Ejemplo n.º 2
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 override LayoutOptions Layout(PaintEventArgs e)
        {
            LayoutOptions layout = CommonLayout();

            layout.hintTextUp          = false;
            layout.everettButtonCompat = !Application.RenderWithVisualStyles;

            if (Application.RenderWithVisualStyles)
            {
                ButtonBase b = Control;
                using (Graphics g = WindowsFormsUtils.CreateMeasurementGraphics()) {
                    layout.checkSize = RadioButtonRenderer.GetGlyphSize(g, RadioButtonRenderer.ConvertFromButtonState(GetState(), b.MouseIsOver), b.HandleInternal).Width;
                }
            }
            else
            {
                layout.checkSize = (int)(layout.checkSize * GetDpiScaleRatio(e.Graphics));
            }

            return(layout);
        }
        protected override LayoutOptions Layout(PaintEventArgs e)
        {
            LayoutOptions layout = CommonLayout();

            layout.hintTextUp          = false;
            layout.everettButtonCompat = !Application.RenderWithVisualStyles;

            // VSWhidbey 420870
            if (Application.RenderWithVisualStyles)
            {
                using (Graphics g = WindowsFormsUtils.CreateMeasurementGraphics()) {
                    layout.checkSize = RadioButtonRenderer.GetGlyphSize(g, RadioButtonRenderer.ConvertFromButtonState(GetState(), Control.MouseIsOver)).Width;
                }
            }
            // Dev10 bug 525537
            else
            {
                layout.checkSize = (int)(layout.checkSize * GetDpiScaleRatio(e.Graphics));
            }

            return(layout);
        }
Ejemplo n.º 5
0
        protected override LayoutOptions Layout(PaintEventArgs e)
        {
            LayoutOptions layout = CommonLayout();

            layout.HintTextUp            = false;
            layout.DotNetOneButtonCompat = !Application.RenderWithVisualStyles;

            if (Application.RenderWithVisualStyles)
            {
                ButtonBase b = Control;
                using var screen = GdiCache.GetScreenHdc();
                layout.CheckSize = RadioButtonRenderer.GetGlyphSize(
                    screen,
                    RadioButtonRenderer.ConvertFromButtonState(GetState(), b.MouseIsOver),
                    b.HandleInternal).Width;
            }
            else
            {
                layout.CheckSize = (int)(layout.CheckSize * GetDpiScaleRatio());
            }

            return(layout);
        }
        protected void DrawCheckBox(PaintEventArgs e, ButtonBaseAdapter.LayoutData layout)
        {
            Graphics  g           = e.Graphics;
            Rectangle checkBounds = layout.checkBounds;

            if (!Application.RenderWithVisualStyles)
            {
                checkBounds.X--;
            }
            ButtonState state = this.GetState();

            if (Application.RenderWithVisualStyles)
            {
                RadioButtonRenderer.DrawRadioButton(g, new Point(checkBounds.Left, checkBounds.Top), RadioButtonRenderer.ConvertFromButtonState(state, this.Control.MouseIsOver));
            }
            else
            {
                ControlPaint.DrawRadioButton(g, checkBounds, state);
            }
        }
        protected void DrawCheckBox(PaintEventArgs e, LayoutData layout)
        {
            Graphics g = e.Graphics;

            Rectangle check = layout.checkBounds;

            if (!Application.RenderWithVisualStyles)
            {
                check.X--;      // compensate for Windows drawing slightly offset to right
            }

            ButtonState style = GetState();

            if (Application.RenderWithVisualStyles)
            {
                RadioButtonRenderer.DrawRadioButton(g, new Point(check.Left, check.Top), RadioButtonRenderer.ConvertFromButtonState(style, Control.MouseIsOver));
            }
            else
            {
                ControlPaint.DrawRadioButton(g, check, style);
            }
        }