private void DrawCheckBox_and_RadioButtonText (ButtonBase button_base, Rectangle text_rectangle, Graphics dc,
StringFormat text_format, Appearance appearance, bool ischecked)
{
// offset the text if it's pressed and a button
if (appearance == Appearance.Button) {
if (ischecked || (button_base.Capture && button_base.FlatStyle != FlatStyle.Flat)) {
text_rectangle.X ++;
text_rectangle.Y ++;
}
text_rectangle.Inflate (-4, -4);
}
/* Place the text; to be compatible with Windows place it after the checkbox has been drawn */
// Windows seems to not wrap text in certain situations, this matches as close as I could get it
if ((float)(button_base.Font.Height * 1.5f) > text_rectangle.Height) {
text_format.FormatFlags |= StringFormatFlags.NoWrap;
}
if (button_base.Enabled) {
dc.DrawString (button_base.Text, button_base.Font, ResPool.GetSolidBrush (button_base.ForeColor), text_rectangle, text_format);
} else if (button_base.FlatStyle == FlatStyle.Flat || button_base.FlatStyle == FlatStyle.Popup) {
dc.DrawString (button_base.Text, button_base.Font, SystemBrushes.ControlDarkDark, text_rectangle, text_format);
} else {
CPDrawStringDisabled (dc, button_base.Text, button_base.Font, button_base.BackColor, text_rectangle, text_format);
}
}
#endregion // CheckBox