protected virtual void ButtonBase_DrawText(ButtonBase button, Graphics dc)
{
Rectangle buttonRectangle = button.ClientRectangle;
Rectangle text_rect = Rectangle.Inflate(buttonRectangle, -4, -4);
if (button.is_pressed) {
text_rect.X++;
text_rect.Y++;
}
// Ensure that at least one line is going to get displayed.
// Line limit does not ensure that despite its description.
text_rect.Height = Math.Max (button.Font.Height, text_rect.Height);
if (button.Enabled) {
dc.DrawString(button.Text, button.Font, ResPool.GetSolidBrush (button.ForeColor), text_rect, button.text_format);
} else {
if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
dc.DrawString(button.Text, button.Font, ResPool.GetSolidBrush (ColorGrayText), text_rect, button.text_format);
} else {
CPDrawStringDisabled (dc, button.Text, button.Font, button.BackColor, text_rect, button.text_format);
}
}
}