Exemple #1
0
        /// <summary>
        /// 绘制 RadioButton。
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="rect"></param>
        /// <param name="checked"></param>
        /// <param name="enabled"></param>
        public virtual void DrawRadioButton(Graphics graphics, Rectangle rect, bool @checked, bool enabled)
        {
            if (Application.RenderWithVisualStyles)
            {
                var element = GetCheckVisualStyleElement(@checked, enabled);
                if (element != null && VisualStyleRenderer.IsElementDefined(element))
                {
                    new VisualStyleRenderer(element).DrawBackground(graphics, rect);
                    return;
                }
            }

            var bstate = ButtonState.Flat;

            if (@checked)
            {
                bstate |= ButtonState.Checked;
            }

            if (!enabled)
            {
                bstate |= ButtonState.Inactive;
            }

            ControlPaint.DrawRadioButton(graphics, rect, bstate);
        }
Exemple #2
0
        private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
        {
            if ((e.ColumnIndex == 2 || e.ColumnIndex == 3) && e.RowIndex >= 0)
            {
                e.PaintBackground(e.ClipBounds, true);

                // TODO: The radio button flickers on mouse over.
                // I tried setting DoubleBuffered on the parent panel, but the flickering persists.
                // If someone figures out how to resolve this, please leave a comment.

                Rectangle rectRadioButton = new Rectangle();
                // TODO: Would be nice to not use magic numbers here.
                rectRadioButton.Width  = 14;
                rectRadioButton.Height = 14;
                rectRadioButton.X      = e.CellBounds.X + (e.CellBounds.Width - rectRadioButton.Width) / 2;
                rectRadioButton.Y      = e.CellBounds.Y + (e.CellBounds.Height - rectRadioButton.Height) / 2;

                ButtonState buttonState;
                if (e.Value == DBNull.Value || (bool)(e.Value) == false)
                {
                    buttonState = ButtonState.Normal;
                }
                else
                {
                    buttonState = ButtonState.Checked;
                }
                ControlPaint.DrawRadioButton(e.Graphics, rectRadioButton, buttonState);

                e.Paint(e.ClipBounds, DataGridViewPaintParts.Focus);

                e.Handled = true;
            }
        }
Exemple #3
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);
            }
        }
Exemple #4
0
        protected override void OnDraw(GraphicsCache graphics, RectangleF area)
        {
            ButtonState state;

            if (Style == ControlDrawStyle.Disabled)
            {
                state = ButtonState.Inactive;
            }
            else if (Style == ControlDrawStyle.Pressed)
            {
                state = ButtonState.Pushed;
            }
            else if (Style == ControlDrawStyle.Hot)
            {
                state = ButtonState.Normal;
            }
            else
            {
                state = ButtonState.Normal;
            }

            if (RadioButtonState == RadioButtonState.Checked)
            {
                state |= ButtonState.Checked;
            }

            ControlPaint.DrawRadioButton(graphics.Graphics, Rectangle.Round(area), state);
        }
Exemple #5
0
        protected override void OnOwnerDraw(Graphics g)
        {
            RadioButton      radioButton = base.HostControl as RadioButton;
            RadioButtonState state       = radioButton.Focused ? RadioButtonState.UncheckedHot : RadioButtonState.UncheckedNormal;

            System.Drawing.ContentAlignment checkAlign = radioButton.CheckAlign;
            Size      glyphSize = RadioButtonRenderer.GetGlyphSize(g, state);
            Rectangle rectangle = base.CalculateCheckBounds(checkAlign, glyphSize);

            if (base["Checked"] == 3)
            {
                int       num        = LayoutHelper.IsRightToLeft(base.HostControl) ? 12 : 8;
                Rectangle targetRect = new Rectangle(rectangle.Left + rectangle.Width - num, rectangle.Top, 8, 8);
                Color     color      = radioButton.Enabled ? radioButton.BackColor : SystemColors.Control;
                using (new SolidBrush(color))
                {
                    g.DrawIcon(Icons.LockIcon, targetRect);
                }
                radioButton.Enabled = false;
                return;
            }
            if (Application.RenderWithVisualStyles)
            {
                RadioButtonRenderer.DrawRadioButton(g, rectangle.Location, state);
                return;
            }
            rectangle.X--;
            ControlPaint.DrawRadioButton(g, rectangle, ButtonState.Normal);
        }
    void ListBox_DrawItem(object sender, DrawItemEventArgs e)
    {
        if (e.Index == -1)
        {
            return;
        }
        Rectangle r = e.Bounds;

        r.Width = r.Height;
        bool selected = (e.State & DrawItemState.Selected) > 0;

        e.DrawBackground();
        e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
        ControlPaint.DrawRadioButton(e.Graphics, r, selected ? ButtonState.Checked : ButtonState.Normal);
        r.X     = r.Right + 2;
        r.Width = e.Bounds.Width - r.X;
        string txt;

        if (ListBox.Site != null && ListBox.Site.DesignMode && e.Index >= ListBox.Items.Count)
        {
            txt = ListBox.Name;
        }
        else
        {
            txt = ListBox.GetItemText(ListBox.Items[e.Index]);
        }
        using (var b = new SolidBrush(e.ForeColor))
            e.Graphics.DrawString(txt, e.Font, b, r);
        if (selected)
        {
            r = e.Bounds;
            r.Width--; r.Height--;
            e.Graphics.DrawRectangle(Pens.DarkBlue, r);
        }
    }
Exemple #7
0
        /// <summary>
        /// 绘制每个项
        /// </summary>
        /// <param name="e"></param>
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            if (e.Index < 0)
            {
                return;
            }
            if (e.Index > this.Items.Count - 1)
            {
                return;
            }

            int size = e.Font.Height; // button size depends on font height, not on item height

            if (IsTransparent && e.State != DrawItemState.Selected)
            {
                e.Graphics.FillRectangle(TransparentBrush, e.Bounds);
            }
            else
            {
                e.DrawBackground();
            }

            Brush       textBrush;
            ButtonState state = ButtonState.Normal;

            if ((e.State & DrawItemState.Disabled) > 0 || (e.State & DrawItemState.Grayed) > 0)
            {
                textBrush = SystemBrushes.GrayText;
                state     = ButtonState.Inactive;
            }
            else if ((e.State & DrawItemState.Selected) > 0 && !Transparent)
            {
                textBrush = SystemBrushes.HighlightText;
            }
            else
            {
                textBrush = SystemBrushes.FromSystemColor(this.ForeColor);
            }
            if ((e.State & DrawItemState.Selected) > 0)
            {
                state |= ButtonState.Checked;
            }

            // Draw radio button
            Rectangle bounds = e.Bounds;

            bounds.Width = size;
            ControlPaint.DrawRadioButton(e.Graphics, bounds, state);

            // Draw text
            bounds = new Rectangle(e.Bounds.X + size + 2, e.Bounds.Y, e.Bounds.Width - size - 2, e.Bounds.Height);
            e.Graphics.DrawString(this.Items[e.Index].ToString(), e.Font, textBrush, bounds, this.Align);

            // If the ListBox has focus, draw a focus rectangle around the selected item.
            e.DrawFocusRectangle();
        }
        public virtual void DrawPressedRadioButton(Graphics g, Rectangle bounds, Color backColor, Color foreColor, bool isChecked)
        {
            ButtonState bs = ButtonState.Pushed;

            if (isChecked)
            {
                bs |= ButtonState.Checked;
            }

            ControlPaint.DrawRadioButton(g, bounds, bs);
        }
Exemple #9
0
        public virtual void DrawDisabledRadioButton(Graphics g, Rectangle_ bounds, Color_ backColor, Color_ foreColor, bool isChecked)
        {
            ButtonState bs = ButtonState.Inactive;

            if (isChecked)
            {
                bs |= ButtonState.Checked;
            }

            ControlPaint.DrawRadioButton(g, bounds, bs);
        }
Exemple #10
0
        /// <summary>
        /// Draws a RadioButton in the specified state, on the specified graphics
        /// surface, and within the specified bounds
        /// </summary>
        /// <param name="g">The Graphics to draw on</param>
        /// <param name="checkRect">The Rectangle that represents the dimensions
        /// of the RadioButton</param>
        /// <param name="clipRect">The Rectangle that represents the clipping area</param>
        /// <param name="state">A RadioButtonState value that specifies the
        /// state to draw the RadioButton in</param>
        public static void DrawRadioButton(Graphics g, Rectangle checkRect, Rectangle clipRect, RadioButtonState state)
        {
            if (g == null || checkRect.Width <= 0 || checkRect.Height <= 0)
            {
                return;
            }

            if (ThemeManager.VisualStylesEnabled)
            {
                //ThemeManager.DrawThemeBackground(g, ThemeClasses.Button, (int) ButtonParts.RadioButton, (int) state, checkRect, clipRect);
                VisualStyleRenderer renderer;
                switch (state)
                {
                case RadioButtonState.CheckedDisabled:
                    renderer = new VisualStyleRenderer(VisualStyleElement.Button.RadioButton.CheckedDisabled);
                    break;

                case RadioButtonState.CheckedHot:
                    renderer = new VisualStyleRenderer(VisualStyleElement.Button.RadioButton.CheckedHot);
                    break;

                case RadioButtonState.CheckedNormal:
                    renderer = new VisualStyleRenderer(VisualStyleElement.Button.RadioButton.CheckedNormal);
                    break;

                case RadioButtonState.CheckedPressed:
                    renderer = new VisualStyleRenderer(VisualStyleElement.Button.RadioButton.CheckedPressed);
                    break;

                case RadioButtonState.UncheckedDisabled:
                    renderer = new VisualStyleRenderer(VisualStyleElement.Button.RadioButton.UncheckedDisabled);
                    break;

                case RadioButtonState.UncheckedHot:
                    renderer = new VisualStyleRenderer(VisualStyleElement.Button.RadioButton.UncheckedHot);
                    break;

                case RadioButtonState.UncheckedPressed:
                    renderer = new VisualStyleRenderer(VisualStyleElement.Button.RadioButton.UncheckedPressed);
                    break;

                case RadioButtonState.UncheckedNormal:
                default:
                    renderer = new VisualStyleRenderer(VisualStyleElement.Button.RadioButton.UncheckedNormal);
                    break;
                }
                renderer.DrawBackground(g, checkRect, clipRect);
            }
            else
            {
                ControlPaint.DrawRadioButton(g, checkRect, ThemeManager.ConvertRadioButtonStateToButtonState(state));
            }
        }
Exemple #11
0
        /// <summary>
        /// Draws a RadioButton in the specified state, on the specified graphics
        /// surface, and within the specified bounds
        /// </summary>
        /// <param name="g">The Graphics to draw on</param>
        /// <param name="checkRect">The Rectangle that represents the dimensions
        /// of the RadioButton</param>
        /// <param name="clipRect">The Rectangle that represents the clipping area</param>
        /// <param name="state">A RadioButtonStates value that specifies the
        /// state to draw the RadioButton in</param>
        public static void DrawRadioButton(Graphics g, Rectangle checkRect, Rectangle clipRect, RadioButtonStates state)
        {
            if (g == null || checkRect.Width <= 0 || checkRect.Height <= 0)
            {
                return;
            }

            if (ThemeManager.VisualStylesEnabled)
            {
                ThemeManager.DrawThemeBackground(g, ThemeClasses.Button, (int)ButtonParts.RadioButton, (int)state, checkRect, clipRect);
            }
            else
            {
                ControlPaint.DrawRadioButton(g, checkRect, ThemeManager.ConvertRadioButtonStateToButtonState(state));
            }
        }
        /// <summary>
        /// Paint content of cell body.
        /// </summary>
        /// <param name="dc">Platform independency graphics context.</param>
        protected override void OnContentPaint(CellDrawingContext dc)
        {
            System.Windows.Forms.ButtonState state = ButtonState.Normal;

            if (this.IsPressed)
            {
                state |= ButtonState.Pushed;
            }
            if (this.IsChecked)
            {
                state |= ButtonState.Checked;
            }

            ControlPaint.DrawRadioButton(dc.Graphics.PlatformGraphics,
                                         (System.Drawing.Rectangle) this.ContentBounds, state);
        }
Exemple #13
0
 protected override void OnDrawItem(DrawItemEventArgs e)
 {
     if ((e.Index >= 0) && (e.Index <= (base.Items.Count - 1)))
     {
         Brush grayText;
         int   height = e.Font.Height;
         if (this.IsTransparent && (e.State != DrawItemState.Selected))
         {
             e.Graphics.FillRectangle(this.TransparentBrush, e.Bounds);
         }
         else
         {
             e.DrawBackground();
         }
         ButtonState normal = ButtonState.Normal;
         if (((e.State & DrawItemState.Disabled) > DrawItemState.None) || ((e.State & DrawItemState.Grayed) > DrawItemState.None))
         {
             grayText = SystemBrushes.GrayText;
             normal   = ButtonState.Inactive;
         }
         else if (((e.State & DrawItemState.Selected) > DrawItemState.None) && !this.Transparent)
         {
             grayText = SystemBrushes.HighlightText;
         }
         else
         {
             grayText = SystemBrushes.FromSystemColor(this.ForeColor);
         }
         if ((e.State & DrawItemState.Selected) > DrawItemState.None)
         {
             normal |= ButtonState.Checked;
         }
         Rectangle bounds = e.Bounds;
         bounds.Width = height;
         if (!this._isCheckBox)
         {
             ControlPaint.DrawRadioButton(e.Graphics, bounds, normal);
         }
         else
         {
             ControlPaint.DrawCheckBox(e.Graphics, bounds, normal);
         }
         bounds = new Rectangle((e.Bounds.X + height) + 2, e.Bounds.Y, (e.Bounds.Width - height) - 2, e.Bounds.Height);
         e.Graphics.DrawString(base.Items[e.Index].ToString(), e.Font, grayText, bounds, this.Align);
         e.DrawFocusRectangle();
     }
 }
Exemple #14
0
        public virtual void DrawRadioButton(Graphics graphics, Control control, Rectangle radioRect, bool drawChecked, bool drawEnabled)
        {
            if (ThemeRenderer.Enabled)
            {
                int state = (drawEnabled ?
                             (drawChecked ? ThemeButton.RadioButtonCheckedNormal : ThemeButton.RadioButtonUncheckedNormal) :
                             (drawChecked ? ThemeButton.RadioButtonCheckedDisabled : ThemeButton.RadioButtonUncheckedDisabled));

                ThemeButton.RadioButton.Draw(graphics, state, radioRect);
            }
            else
            {
                ButtonState state = (drawChecked ? ButtonState.Checked : 0);
                state |= (!drawEnabled ? ButtonState.Inactive : ButtonState.Normal);
                ControlPaint.DrawRadioButton(graphics, radioRect, state);
            }
        }
 protected override void OnPaint(PaintEventArgs args)
 {
     base.OnPaint(args);
     if (Focused)
     {
         ControlPaint.DrawFocusRectangle(args.Graphics, DisplayRectangle);
     }
     if (_buttonBounds != null)
     {
         Rectangle   bounds;
         ButtonState baseState = (Enabled ? ButtonState.Normal : ButtonState.Inactive);
         using (Brush brush = new SolidBrush(ForeColor))
         {
             using (Pen pen = new Pen(ForeColor))
             {
                 for (int i = 0; i < _items.Length; i++)
                 {
                     bounds = _buttonBounds[i];
                     if (args.Graphics.IsVisible(bounds))
                     {
                         ControlPaint.DrawRadioButton
                         (
                             args.Graphics,
                             bounds.Left,
                             bounds.Top,
                             RadioButtonSize,
                             RadioButtonSize,
                             baseState | (i == _selectedIndex ? ButtonState.Checked : 0)
                         );
                         bounds.X     += RadioButtonSize + ButtonSpacing;
                         bounds.Width -= RadioButtonSize + ButtonSpacing;
                         args.Graphics.DrawString
                         (
                             _items[i],
                             Font,
                             brush,
                             bounds,
                             Format
                         );
                     }
                 }
             }
         }
     }
 }
        protected override void OnPaint(PaintEventArgs e)  //PTK added
        {
            this.OnPaintBackground(e);
            base.OnPaint(e);
            this.AutoSize = false;
            text          = this.Text;
            Color      c1      = Color.Transparent;
            Color      c2      = Color.Transparent;
            Brush      b       = new System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, c1, c2, angle);
            SolidBrush frcolor = new SolidBrush(Color.Black);

            e.Graphics.FillRectangle(b, ClientRectangle);
            e.Graphics.DrawString(text, new System.Drawing.Font("MS Gothic", 26F, System.Drawing.FontStyle.Bold), frcolor, new Point(textX, textY));
            Rectangle rc = new Rectangle(boxlocatx, boxlocaty, boxsize, boxsize);

            ControlPaint.DrawRadioButton(e.Graphics, rc, this.Checked ? ButtonState.Checked : ButtonState.Normal);
            b.Dispose();
        }
Exemple #17
0
 protected override void OnDrawItem(DrawItemEventArgs e)
 {
     // Draw item with radio button
     using (var br = new SolidBrush(this.BackColor))
         e.Graphics.FillRectangle(br, e.Bounds);
     if (e.Index < this.Items.Count)
     {
         Rectangle rc = new Rectangle(e.Bounds.Left, e.Bounds.Top, e.Bounds.Height, e.Bounds.Height);
         ControlPaint.DrawRadioButton(e.Graphics, rc,
                                      e.Index == SelectedOption ? ButtonState.Checked : ButtonState.Normal);
         rc = new Rectangle(rc.Right, e.Bounds.Top, e.Bounds.Width - rc.Right, e.Bounds.Height);
         TextRenderer.DrawText(e.Graphics, this.Items[e.Index].ToString(), this.Font, rc, this.ForeColor, TextFormatFlags.Left);
     }
     if ((e.State & DrawItemState.Focus) != DrawItemState.None)
     {
         e.DrawFocusRectangle();
     }
 }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            this.AutoSize = false;
            text          = this.Text;
            Color      c1      = Color.FromArgb(color1Transparent, color1);
            Color      c2      = Color.FromArgb(color2Transparent, color2);
            Brush      b       = new System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, c1, c2, angle);
            SolidBrush frcolor = new SolidBrush(this.ForeColor);

            e.Graphics.FillRectangle(b, ClientRectangle);
            e.Graphics.DrawString(text, this.Font, frcolor, new Point(textX, textY));
            Rectangle rc = new Rectangle(boxlocatx, boxlocaty, boxsize, boxsize);

            //draw RadioButton
            ControlPaint.DrawRadioButton(e.Graphics, rc, this.Checked ? ButtonState.Checked : ButtonState.Normal);
            b.Dispose();
        }
        private void DrawRadioButton(RadioButton rdo, Point p, Graphics g)
        {
            // Setup the size of a RadioButton
            Rectangle rRadioButton = new Rectangle(p.X, p.Y, 12, 12);

            ControlPaint.DrawRadioButton(g, p.X,
                                         p.Y + (rdo.Height / 2) - (rRadioButton.Height / 2),
                                         rRadioButton.Width,
                                         rRadioButton.Height,
                                         (rdo.Checked ? ButtonState.Checked : ButtonState.Normal));

            // RadioButton's text left justified & centered vertically
            g.DrawString(rdo.Text,
                         rdo.Font,
                         new SolidBrush(rdo.ForeColor),
                         rRadioButton.Right + 1,
                         p.Y + (rdo.Height / 2) - (g.MeasureString(rdo.Text, rdo.Font).Height / 2));
        }
        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);
            }
        }
Exemple #21
0
        /// <summary>
        /// Paint content of cell body.
        /// </summary>
        /// <param name="dc">Platform independency graphics context.</param>
        protected override void OnContentPaint(CellDrawingContext dc)
        {
#if WINFORM
            System.Windows.Forms.ButtonState state = ButtonState.Normal;

            if (this.IsPressed)
            {
                state |= ButtonState.Pushed;
            }
            if (this.IsChecked)
            {
                state |= ButtonState.Checked;
            }

            ControlPaint.DrawRadioButton(dc.Graphics.PlatformGraphics,
                                         (System.Drawing.Rectangle) this.ContentBounds, state);
#elif WPF
            var g = dc.Graphics;

            var ox = this.ContentBounds.OriginX;
            var oy = this.ContentBounds.OriginY;

            var hw = this.ContentBounds.Width / 2;
            var hh = this.ContentBounds.Height / 2;
            var r  = new Rectangle(ox - hw / 2, oy - hh / 2, hw, hh);
            g.DrawEllipse(StaticResources.SystemColor_ControlDark, r);

            if (this.IsPressed)
            {
                g.FillEllipse(StaticResources.SystemColor_Control, r);
            }

            if (this.isChecked)
            {
                var hhw = this.ContentBounds.Width / 4;
                var hhh = this.ContentBounds.Height / 4;
                r = new Rectangle(ox - hhw / 2, oy - hhh / 2, hhw, hhh);
                g.FillEllipse(StaticResources.SystemColor_WindowText, r);
            }
#endif // WINFORM
        }
        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);
            }
        }
        /// <inheritdoc/>
        protected override void Render(RadioButton control, PaintEventArgs e)
        {
            var x = e.LogicalToDeviceUnits(11);
            var y = control.ScaledHeight / 2;

            ControlPaint.DrawRadioButton(e, new Point(x, y), control.Checked ? CheckState.Checked : CheckState.Unchecked, !control.Enabled);

            var text_bounds = control.ClientRectangle;
            var unit_24     = e.LogicalToDeviceUnits(24);
            var unit_5      = e.LogicalToDeviceUnits(5);

            text_bounds.X     += unit_24;
            text_bounds.Width -= unit_24;

            if (control.Selected && control.ShowFocusCues)
            {
                var focus_bounds = new Rectangle(text_bounds.X - unit_5, 0, text_bounds.Width + unit_5, text_bounds.Height);
                e.Canvas.DrawFocusRectangle(focus_bounds, e.LogicalToDeviceUnits(3));
            }

            e.Canvas.DrawText(control.Text, text_bounds, control, ContentAlignment.MiddleLeft);
        }
Exemple #24
0
        /// <summary>
        /// Method to paint the dataGridViewPhysician radio buttons
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns>
        /// </returns>
        private void dataGridViewPhysicians_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
        {
            if (e.ColumnIndex == Email.Index && e.RowIndex >= 0)
            {
                e.PaintBackground(e.ClipBounds, true);

                Rectangle rectRadioButton = new Rectangle();

                rectRadioButton.Width  = 14;
                rectRadioButton.Height = 14;
                rectRadioButton.X      = e.CellBounds.X + (e.CellBounds.Width - rectRadioButton.Width) / 2;
                rectRadioButton.Y      = e.CellBounds.Y + (e.CellBounds.Height - rectRadioButton.Height) / 2;

                ButtonState buttonState;


                if (e.Value == null || (bool)(e.Value) == false)
                {
                    buttonState = ButtonState.Normal;
                }
                else
                {
                    buttonState = ButtonState.Checked;
                }


                ControlPaint.DrawRadioButton(e.Graphics, rectRadioButton, buttonState);

                e.Paint(e.ClipBounds, DataGridViewPaintParts.Focus);

                e.Handled = true;
            }



            if (e.ColumnIndex == Fax.Index && e.RowIndex >= 0)
            {
                e.PaintBackground(e.ClipBounds, true);

                Rectangle rectRadioButton = new Rectangle();

                rectRadioButton.Width  = 14;
                rectRadioButton.Height = 14;
                rectRadioButton.X      = e.CellBounds.X + (e.CellBounds.Width - rectRadioButton.Width) / 2;
                rectRadioButton.Y      = e.CellBounds.Y + (e.CellBounds.Height - rectRadioButton.Height) / 2;

                ButtonState buttonState;


                if (e.Value == null || (bool)(e.Value) == false)
                {
                    buttonState = ButtonState.Normal;
                }
                else
                {
                    buttonState = ButtonState.Checked;
                }


                ControlPaint.DrawRadioButton(e.Graphics, rectRadioButton, buttonState);

                e.Paint(e.ClipBounds, DataGridViewPaintParts.Focus);

                e.Handled = true;
            }

            if (e.ColumnIndex == Paper.Index && e.RowIndex >= 0)
            {
                e.PaintBackground(e.ClipBounds, true);

                Rectangle rectRadioButton = new Rectangle();

                rectRadioButton.Width  = 14;
                rectRadioButton.Height = 14;
                rectRadioButton.X      = e.CellBounds.X + (e.CellBounds.Width - rectRadioButton.Width) / 2;
                rectRadioButton.Y      = e.CellBounds.Y + (e.CellBounds.Height - rectRadioButton.Height) / 2;

                ButtonState buttonState;

                if (e.Value == null || (bool)(e.Value) == false)
                {
                    buttonState = ButtonState.Normal;
                }
                else
                {
                    buttonState = ButtonState.Checked;
                }


                ControlPaint.DrawRadioButton(e.Graphics, rectRadioButton, buttonState);

                e.Paint(e.ClipBounds, DataGridViewPaintParts.Focus);

                e.Handled = true;
            }
        }