Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I put bitmap icons on a StatusBar?

Status
Not open for further replies.

dredfern

Technical User
Dec 7, 2003
14
GB
I want to put a couple of bitmap icons on a status bar to show when certain options have been selected by the user. Any ideas?
 
Set the style property to psOwnerDraw in the status bar panel(s) that you want the icons displayed.

Write appropriate code in the OnDrawPanel event handler of the status bar to show your icons.

The following, very simple example, displays a different graphic in the status bar depending on whether a checkbox is checked or not.
Code:
procedure TForm1.SBDrawPanel(StatusBar: TStatusBar;
  Panel: TStatusPanel; const Rect: TRect);
begin
  if checkbox.checked then
    statusbar.Canvas.Draw( Rect.Left, Rect.Top, G1.Picture.Graphic )
  else
    statusbar.Canvas.Draw( Rect.Left, Rect.Top, G2.Picture.Graphic );
end;

procedure TForm1.CheckBoxClick(Sender: TObject);
begin
  SB.Invalidate
end;

Andrew
Hampshire, UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top