Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Displaying an Icon on a StatusBar

Posted on 1999-09-17
9
Medium Priority
?
327 Views
Last Modified: 2010-05-18
Hello out there,

How can I display an ICO-File in the last Panel-Index of a StatusBar on my Form. Is that possible at all, since there is not Picture-Object or something.

I think it works somehow using a Canvas, but I have no Idea how, I'm not very familiar with Canvas-Objects.
0
Comment
Question by:omsec
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 3

Expert Comment

by:bryan7
ID: 2053954
try looking for a component here:

http://www.torry.ru    click on VCL
0
 
LVL 17

Expert Comment

by:inthe
ID: 2054040
um..cant you just put a timage component on the statusbar and load a icon into it..
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2054073
hi omsec,

you can also just paint it on the panel-canvas,
there is somethimg similar in my paq,
i will take a look

meikl
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 2054172
yup, here is it

(the OnDrawPanel-Event)

procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar;
  Panel: TStatusPanel; const Rect: TRect);
var
  MyRect : TRect;
  MyBmp : TBitMap;

begin
  MyBmp := TBitMap.Create;
  MyRect.Top := 1;
  MyRect.Bottom := statusbar1.Height - 1;
  MyRect.Left := statusbar1.Width - 16;
  MyRect.Right := statusbar1.Width - 1;
  Imagelist1.GetBitmap(0,MyBmp);
  Statusbar1.Canvas.StretchDraw(MyRect,MyBmp);
  MyBmp.Free;
end;

i guess its not exactly, where you are looking for, but i guess also that this shows a way how could it be done.

the panel is an parameter here, you can check there if it the panel where it should displayed, and you can use the rect to determine the position.

meikl
0
 
LVL 2

Author Comment

by:omsec
ID: 2054235
Statusbar1.Canvas.StretchDraw(MyRect,MyBmp);
 
this seems to be the line which draws the ICO.
But how to specify where the Picture should be painted ?
Would it be helpfull if i tell you the Index Nummber or Left/Top Pos ?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2054336
hi omsec,

in my sample the image is painted right on statusbar
-> thats the calculation of myrect

Imagelist1.GetBitmap(0,MyBmp); -> here you get your icon from a imagelist as Bitmap, because icons cannot be stretched, the first parameter is the index of the image in the imagelist.

hope its helps, just ask if not

meikl
 
0
 
LVL 2

Author Comment

by:omsec
ID: 2054567
I have pasted this code and it compiled without errors.
but unfortunally, i can't see anything of that ICO in the StatusBar.

Perhaps, i should mention, that the StatusBar's Parent Form is an MDIchild.

any ideas?
0
 

Accepted Solution

by:
shebin earned 200 total points
ID: 2054584
a demo below:

1.Set your StatusBar.Panel[0].Style:=psOwnerDraw
2.in your StatusBar.OnDrawPanel event:
procedure TForm1.StatusBar1DrawPanel(StatusBar:TStatusBar;
  Panel: TStatusPanel; const Rect: TRect);
var icon:TIcon;
begin
     icon:=TIcon.Create;
     icon.LoadFromFile('xxx.ico');
     DrawIcon(StatusBar.Canvas.Handle,Rect.Left,Rect.Top,
              icon.Handle);
     icon.Free;
end;
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2056233
yup, forgotten to say

panel-property Style = psOwnerDraw

do this on the panel with the highest index,
if there are more then one

meikl ;-)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question