1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| procedure TForm1.FormCreate(Sender: TObject);
begin
StatusBar1.Panels[0].Style := psOwnerDraw;
end;
procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect);
var
SomeText: string;
begin
if Panel = StatusBar1.Panels[0] then
begin
SomeText := 'Hello ! qi130';
Panel.Width := Trunc(StatusBar1.Canvas.TextWidth(SomeText) * 1.5);
with StatusBar.Canvas do
begin
Brush.Color := ClYellow;
FillRect(Rect);
Font.Name := 'Arial';
Font.Color := clRed;
Font.Style := Font.Style + [fsItalic, fsBold];
TextRect(Rect, Rect.Left + 1, Rect.Top, SomeText);
end;
end;
end; |
Partager