RAD Studio VCL Reference
|
Determines how the status panel's text is displayed.
property Style: TStatusPanelStyle;
__property TStatusPanelStyle Style;
If Style is set to psText (the default), the string contained in the Text property is displayed in the status panel, using the alignment specified by Alignment. The font is determined by the status bar's Font property.
If Style is set to psOwnerDraw, the content displayed in the status panel is drawn at runtime on the status bar's canvas by code in an OnDrawPanel event handler.
C++ Examples:
/* The following code is the OnDrawPanel event handler of a status bar. It draws each panel of the status bar, adding text and icons stored in ImageList1. The image list contains as many icons as there are header sections. This example requires a populated image list and a statusbar with several panels added to the Panels property. Select each panel and set the Style property to psOwnerDraw. */ void __fastcall TForm1::StatusBar1DrawPanel(TStatusBar *StatusBar, TStatusPanel *Panel, const TRect &Rect) { TCanvas *canvas = StatusBar->Canvas; canvas->Brush->Color = clRed; canvas->FillRect(Rect); canvas->Font->Color = clYellow; ImageList1->Draw(canvas,Rect.Left,Rect.Top, Panel->Index, true); canvas->TextOut(Rect.left + 30, Rect.top + 2, "Panel" + IntToStr(Panel->Index)); }
Delphi Examples:
{ The following code is the OnDrawPanel event handler of a status bar. It draws each panel of the status bar, adding text and icons stored in ImageList1. The image list contains as many icons as there are header sections. This example requires a populated image list and a statusbar with several panels added to the Panels property. Select each panel and set the Style property to psOwnerDraw. } procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect); begin with StatusBar1.Canvas do begin Brush.Color := clRed; FillRect(Rect); Font.Color := clYellow; ImageList1.Draw(StatusBar1.Canvas,Rect.Left,Rect.Top,Panel.Index); TextOut(Rect.left + 30, Rect.top + 2, 'Panel' + IntToStr(Panel.Index)); end; end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|