delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
498 Users Online NOW
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi



Loremo - the 1.5 liter car coming in 2009




Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (3)


Add Image To StartusbarGo to colin pringle's websiteComponent available for this articleFormat this article printer-friendly!Bookmark function is only available for registered users!
Make Application Look Better
Product:
Delphi all versions
Category:
GUI
Skill Level:
Scoring:
Last Update:
12/29/2001
Search Keys:
delphi delphi3000 article borland vcl code-snippet statusbar icons imagelist images gui look
Times Scored:
5
Visits:
5015
Uploader: colin pringle
Company: cjpsoftware
Reference: cjpsoftware.com
Component Download: http://www.cjpsoftware.com
 
Question/Problem/Abstract:
How do I add an Icon to a statusbar
Answer:





ShellSPY V1.1a

is the award winning and powerful monitoring solution that you need! ShellSPY
gives you the power to log all keystrokes, windows viewed, applications ran, internet
connections made, passwords entered, chat conversations that were made, Monitor
all running tasks on your pc Download
Now


  



Web Site:
Cjpsoftware.com

To Learn More Tips from cjp


// Yo Ho!
// Author C Pringle (Cjpsoftware.com)

// Drop an imagelist component onto your form
// add some 16x16 insize images to the imagelist
// makesure the component name is called imagelist1
// Add your statusbar to the form.
// ----------
// Statusbar
//-----------
// Now add a statusbar panel by clicking on the statusbar
// Then select add.
// Change the style option on the object inspector to psOwnerDraw.
// For the item you just created.
//------------
// Displaying text along with graphics on the statusbar.
// Add a text message to message1 array.
// then use the refresh command and it is done.
//-------
// Example.
//--------
// I want image 0 in the imagelist to be displayed
// on my statusbar with the text message "I love Delphi"
// Message[0] := "I Love Delphi";
// Statusbar1.refresh;
//
// To change the image displayed on the statusbar.
// Imagelist1.Draw(StatusBar1.Canvas,Rect.Left,Rect.Top,0);
//                                                      ^
// Change ^ to the image number in the imagelist I.E its index


Var message1: array[0..10] of string;

implementation

{$R *.DFM}

procedure Tform1.StatusBar1DrawPanel(StatusBar: TStatusBar;
  Panel: TStatusPanel; const Rect: TRect);
with StatusBar1.Canvas do
  begin
    Brush.Color := clBtnFace;
    FillRect(Rect);
    Font.Color := clblack;
    Imagelist1.Draw(StatusBar1.Canvas,Rect.Left,Rect.Top,2);
    TextOut(Rect.left + 20, Rect.top + 2,Message1[0]);
End;
End;






Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Manipulate all panels in the statusbar
    cristian rodriguez (Jul 22 2007 9:19PM)

//with that method is simple to add a image but just only to
//panel...use it like this to manipulate all ur panels (copy from delphi
//club "Ruben_Cu")

//procedure TFormMain.StatusBar1DrawPanel(StatusBar: TStatusBar;
  //Panel: TStatusPanel; const Rect: TRect);
//begin
//case Panel.Index of // this part
//0: with StatusBar1.Canvas do
//  begin
    //Brush.Color := clBtnFace;
    //FillRect(Rect);
    //Font.Color := clblack;
//    Imagelist1.Draw(StatusBar1.Canvas,Rect.Left,Rect.Top,1);
//    TextOut(Rect.left + 20, Rect.top + 2,'blablablabla');
//  end;
//1: with StatusBar1.Canvas do
//  begin
    //Brush.Color := clBtnFace;
    //FillRect(Rect);
    //Font.Color := clblack;
//    Imagelist1.Draw(StatusBar1.Canvas,Rect.Left,Rect.Top,0);
//    TextOut(Rect.left + 20, Rect.top + 2,'blablablabla');
//  end;
//end;
//end;
Respond

Manipulate all panels in the statusbar
    cristian rodriguez (Jul 22 2007 9:18PM)

with that method is simple to add a image but just only to 1 panel...use it like this to manipulate all ur panels (copy from delphi club "Ruben_Cu")

procedure TFormMain.StatusBar1DrawPanel(StatusBar: TStatusBar;
  Panel: TStatusPanel; const Rect: TRect);
begin
case Panel.Index of // this part
0: with StatusBar1.Canvas do
  begin
    //Brush.Color := clBtnFace;
    //FillRect(Rect);
    //Font.Color := clblack;
    Imagelist1.Draw(StatusBar1.Canvas,Rect.Left,Rect.Top,1);
    TextOut(Rect.left + 20, Rect.top + 2,'blablablabla');
  end;
1: with StatusBar1.Canvas do
  begin
    //Brush.Color := clBtnFace;
    //FillRect(Rect);
    //Font.Color := clblack;
    Imagelist1.Draw(StatusBar1.Canvas,Rect.Left,Rect.Top,0);
    TextOut(Rect.left + 20, Rect.top + 2,'blablablabla');
  end;
end;
end;
Respond

How can Add text???
    cristian rodriguez (Jul 22 2007 9:17PM)

with that method is simple to add a image but just only to 1 panel...use it like this to manipulate all ur panels (copy from delphi club "Ruben_Cu")

procedure TFormMain.StatusBar1DrawPanel(StatusBar: TStatusBar;
  Panel: TStatusPanel; const Rect: TRect);
begin
case Panel.Index of // this part
0: with StatusBar1.Canvas do
  begin
    //Brush.Color := clBtnFace;
    //FillRect(Rect);
    //Font.Color := clblack;
    Imagelist1.Draw(StatusBar1.Canvas,Rect.Left,Rect.Top,1);
    TextOut(Rect.left + 20, Rect.top + 2,'blablablabla');
  end;
1: with StatusBar1.Canvas do
  begin
    //Brush.Color := clBtnFace;
    //FillRect(Rect);
    //Font.Color := clblack;
    Imagelist1.Draw(StatusBar1.Canvas,Rect.Left,Rect.Top,0);
    TextOut(Rect.left + 20, Rect.top + 2,'blablablabla');
  end;
end;
end;
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
M. Maes
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)