Mega Code Archive

 
Categories / Delphi / Graphic
 

Add Image To Startusbar

Title: Add Image To Startusbar Question: 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;