public override void DrawStatusBar (Graphics real_dc, Rectangle clip, StatusBar sb) {
Rectangle area = sb.ClientRectangle;
int horz_border = 2;
int vert_border = 2;
Image backbuffer = new Bitmap (sb.ClientSize.Width, sb.ClientSize.Height, real_dc);
Graphics dc = Graphics.FromImage (backbuffer);
DrawStatusBarBackground (dc, clip, sb);
if (!sb.ShowPanels && sb.Text != String.Empty) {
string text = sb.Text;
StringFormat string_format = new StringFormat ();
string_format.Trimming = StringTrimming.Character;
string_format.FormatFlags = StringFormatFlags.NoWrap;
if (text.Length > 127)
text = text.Substring (0, 127);
if (text [0] == '\t') {
string_format.Alignment = StringAlignment.Center;
text = text.Substring (1);
if (text [0] == '\t') {
string_format.Alignment = StringAlignment.Far;
text = text.Substring (1);
}
}
dc.DrawString (text, sb.Font, ResPool.GetSolidBrush (sb.ForeColor),
new Rectangle(area.X + 2, area.Y + 2, area.Width - 4, area.Height - 4), string_format);
string_format.Dispose ();
} else if (sb.ShowPanels) {
Brush br_forecolor = GetControlForeBrush (sb.ForeColor);
int prev_x = area.X + horz_border;
int y = area.Y + vert_border;
for (int i = 0; i < sb.Panels.Count; i++) {
Rectangle pr = new Rectangle (prev_x, y,
sb.Panels [i].Width, area.Height);
prev_x += pr.Width + StatusBarHorzGapWidth;
if (pr.IntersectsWith (clip))
DrawStatusBarPanel (dc, pr, i, br_forecolor, sb.Panels [i]);
}
}
if (sb.SizingGrip)
DrawStatusBarSizingGrip (dc, clip, sb, area);
real_dc.DrawImage (backbuffer, 0, 0);
dc.Dispose ();
backbuffer.Dispose ();
}