Mega Code Archive

 
Categories / Delphi / VCL
 

How to change the font style of a statusbar

Title: How to change the font style of a statusbar procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect); var SomeText: string; begin if Panel = StatusBar1.Panels[0] then begin SomeText := 'Hello!'; Panel.Width := Trunc(StatusBar1.Canvas.TextWidth(SomeText) * 1.5); with StatusBar.Canvas do begin Brush.Color := clWhite; 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;