Author: Tomas Rutkauskas
I need to write in bold or underlined in a statusbar. I have tried to use the owner
draw options however I never get it right.
Answer:
Set the style property of the StatusPanel to psOwnerDraw and add following event
handler:
1 2 procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar;
3 Panel: TStatusPanel; const Rect: TRect);
4 var5 ts: TSize;
6 begin7 with StatusBar.Canvas do8 begin9 Font.Style := [fsBold];
10 ts := TextExtent(Panel.Text);
11 TextRect(Rect, 0, (Rect.Top + Rect.Bottom - ts.cy) div 2, Panel.Text);
12 end;
13 end;