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);
            }
        }