?
Solved

Different OnDrawPanel for different TStausBar's

Posted on 2002-05-22
5
Medium Priority
?
314 Views
Last Modified: 2012-06-21
I want to be able to cange the font to bold the text on a number of TStatusPanels. I set the TStatusPanel.Style to psOwnerDraw and add a TStatusBar.OnDrawPanel event which paint my text via TextRect. The problem is that the OnDrawPanel applies for each Panel that has the style set to psOwnerDraw. I want a number of panels to have bold but different text. Can I do this?

Thanks, Tom.
0
Comment
Question by:tomcorcoran
[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
  • 2
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
DragonSlayer earned 200 total points
ID: 7028952
OnDrawPanel also passes a Panel parameter, so from there you can know which Panel you will be drawing to.

e.g. if you only want to Bold the text for Panels 0 and 3:

if Panel.Index in [0, 3] then
  StatusBar1.Canvas.Pen.Font.Style := [fsBold];
StatusBar1.Canvas.TextOut(Rect.Left, Rect.Top, 'This is Panel ' + IntToStr(Panel.Index));
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7028973
listening
0
 

Author Comment

by:tomcorcoran
ID: 7029480
I had the TStatusPanel text and bold attributes stored in a TList so I got at them via the Panel.Index. Great idea, thanks.

FYI, it's StatusBar1.Canvas.Font.Style := [fsBold];

Now the text which is in the OnOwnerDraw panels is a pixel or two higher than the text in the normal panels. I would like the difference not to be obvious to the idea. TRct.Bottom can't be directly adjusted. Any ideas?

Thanks a million, Tom.

0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 7030971
Ooops, my mistake on the Pen part :)

to adjust the Rect, you need to create your own variable

var
  myRect: TRect;
begin
  myRect := Rect;
  // now you can adjust the Rect, for example:
  // Dec(myRect.Bottom, 2);
  StatusBar1.Canvas.TextOutRect(myRect, myRect.Left, myRect.Top + 2, 'Hello');
end;
0
 

Author Comment

by:tomcorcoran
ID: 7031672
That worked a peach mate, thanks! Tom.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month15 days, 16 hours left to enroll

743 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