コード例 #1
0
 protected void DrawCheckBackground(PaintEventArgs e, Rectangle bounds, Color checkColor, Color checkBackground, bool disabledColors, ButtonBaseAdapter.ColorData colors)
 {
     if (this.Control.CheckState == CheckState.Indeterminate)
     {
         ButtonBaseAdapter.DrawDitheredFill(e.Graphics, colors.buttonFace, checkBackground, bounds);
     }
     else
     {
         DrawCheckBackground(this.Control.Enabled, this.Control.CheckState, e.Graphics, bounds, checkColor, checkBackground, disabledColors, colors);
     }
 }
コード例 #2
0
        protected void DrawCheckFlat(PaintEventArgs e, ButtonBaseAdapter.LayoutData layout, Color checkColor, Color checkBackground, Color checkBorder, ButtonBaseAdapter.ColorData colors)
        {
            Rectangle checkBounds = layout.checkBounds;

            if (!layout.options.everettButtonCompat)
            {
                checkBounds.Width--;
                checkBounds.Height--;
            }
            using (WindowsGraphics graphics = WindowsGraphics.FromGraphics(e.Graphics))
            {
                using (WindowsPen pen = new WindowsPen(graphics.DeviceContext, checkBorder))
                {
                    graphics.DrawRectangle(pen, checkBounds);
                }
                if (layout.options.everettButtonCompat)
                {
                    checkBounds.Width--;
                    checkBounds.Height--;
                }
                checkBounds.Inflate(-1, -1);
            }
            if (this.Control.CheckState == CheckState.Indeterminate)
            {
                checkBounds.Width++;
                checkBounds.Height++;
                ButtonBaseAdapter.DrawDitheredFill(e.Graphics, colors.buttonFace, checkBackground, checkBounds);
            }
            else
            {
                using (WindowsGraphics graphics2 = WindowsGraphics.FromGraphics(e.Graphics))
                {
                    using (WindowsBrush brush = new WindowsSolidBrush(graphics2.DeviceContext, checkBackground))
                    {
                        checkBounds.Width++;
                        checkBounds.Height++;
                        graphics2.FillRectangle(brush, checkBounds);
                    }
                }
            }
            this.DrawCheckOnly(e, layout, colors, checkColor, checkBackground, true);
        }