protected virtual void DrawFlatStyleRadioButton (Graphics graphics, Rectangle rectangle, RadioButton radio_button)
{
int lineWidth;
if (radio_button.Enabled) {
// draw the outer flatstyle arcs
if (radio_button.FlatStyle == FlatStyle.Flat) {
graphics.DrawArc (SystemPens.ControlDarkDark, rectangle, 0, 359);
// fill in the area depending on whether or not the mouse is hovering
if ((radio_button.is_entered || radio_button.Capture) && !radio_button.is_pressed) {
graphics.FillPie (SystemBrushes.ControlLight, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
} else {
graphics.FillPie (SystemBrushes.ControlLightLight, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
}
} else {
// must be a popup radio button
// fill the control
graphics.FillPie (SystemBrushes.ControlLightLight, rectangle, 0, 359);
if (radio_button.is_entered || radio_button.Capture) {
// draw the popup 3d button knob
graphics.DrawArc (SystemPens.ControlLight, rectangle.X+1, rectangle.Y+1, rectangle.Width-2, rectangle.Height-2, 0, 359);
graphics.DrawArc (SystemPens.ControlDark, rectangle, 135, 180);
graphics.DrawArc (SystemPens.ControlLightLight, rectangle, 315, 180);
} else {
// just draw lighter flatstyle outer circle
graphics.DrawArc (SystemPens.ControlDark, rectangle, 0, 359);
}
}
} else {
// disabled
// fill control background color regardless of actual backcolor
graphics.FillPie (SystemBrushes.Control, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
// draw the ark as control dark
graphics.DrawArc (SystemPens.ControlDark, rectangle, 0, 359);
}
// draw the check
if (radio_button.Checked) {
lineWidth = Math.Max (1, Math.Min(rectangle.Width, rectangle.Height)/3);
Pen dot_pen = SystemPens.ControlDarkDark;
Brush dot_brush = SystemBrushes.ControlDarkDark;
if (!radio_button.Enabled || ((radio_button.FlatStyle == FlatStyle.Popup) && radio_button.is_pressed)) {
dot_pen = SystemPens.ControlDark;
dot_brush = SystemBrushes.ControlDark;
}
if (rectangle.Height > 13) {
graphics.FillPie (dot_brush, rectangle.X + lineWidth, rectangle.Y + lineWidth, rectangle.Width - lineWidth * 2, rectangle.Height - lineWidth * 2, 0, 359);
} else {
int x_half_pos = (rectangle.Width / 2) + rectangle.X;
int y_half_pos = (rectangle.Height / 2) + rectangle.Y;
graphics.DrawLine (dot_pen, x_half_pos - 1, y_half_pos, x_half_pos + 2, y_half_pos);
graphics.DrawLine (dot_pen, x_half_pos - 1, y_half_pos + 1, x_half_pos + 2, y_half_pos + 1);
graphics.DrawLine (dot_pen, x_half_pos, y_half_pos - 1, x_half_pos, y_half_pos + 2);
graphics.DrawLine (dot_pen, x_half_pos + 1, y_half_pos - 1, x_half_pos + 1, y_half_pos + 2);
}
}
}