Solved

How can I format the text of the StatusBar?

Posted on 2002-03-19
16
319 Views
Last Modified: 2010-08-05
Hi all,
How can I format the text of the StatusBar?
e.g. Change the text of StatusBar.Panels[1]  to  "Red" and "Bold"?
(Just change the StatusBar.Panels[1], don't change other Panels)

Thanks, Bin
0
Comment
Question by:xbbin
  • 7
  • 4
  • 2
  • +2
16 Comments
 
LVL 9

Accepted Solution

by:
ginsonic earned 30 total points
ID: 6879623
Read these :

How to draw coloured text on a TStatusBar
http://www.lmc-mediaagentur.de/dpool/tips01/0034.htm

How to write bold text on a TStatusBar
http://www.lmc-mediaagentur.de/dpool/tips02/0164.htm
0
 

Author Comment

by:xbbin
ID: 6879880
Hi ginsonic,
How can I just format the text of StatusBar.Panels[1], don't format StatusBar.Panels[0] and StatusBar.Panels[2]?
0
 
LVL 2

Expert Comment

by:Drareg
ID: 6879950
Procedure  TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar;
  Panel: TStatusPanel;  Const  Rect: TRect);
Begin
  If Panel = StatusBar1.Panels[0] Then
      With StatusBar1.Canvas Do
          Begin
              Font.Color := clRed ;
              TextOut(Rect.left, Rect.top + 2, 'Hello' ) ;
              Font.Color := clBlue ;
              TextOut(Rect.left+30, Rect.top + 2, 'World' ) ;
          End ;

  If Panel = StatusBar1.Panels[2] Then
      With StatusBar1.Canvas Do
          Begin
              Font.Color := clYellow ;
              TextOut(Rect.Left + 12, Rect.Top + 2, 'Patatouf') ;
          End ;
End ;
0
 

Expert Comment

by:DelFreak
ID: 6879995
Listening...
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6880322
Have you read my tips ? All what you need are there
.
procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar;
Panel: TStatusPanel; const Rect: TRect);
begin

  if Panel = StatusBar.Panels[1] then
  begin
    StatusBar.Canvas.Font.Color := clRed;
    StatusBar.Canvas.TextOut(Rect.Left, Rect.Top, MyText' )
   end;

end;
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6880326
In tip sample is used Panel[0] but you can choice your own panel . Just use
 if Panel = StatusBar.Panels[YourPanel] then ...
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6880341
DelFreak have you receive my mail ?
How work the project into your system ?

Regards,
Nick
0
 

Author Comment

by:xbbin
ID: 6881534
Hi ginsonic,
How can I change the text color at runtime?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 6881675
LOL!  Didn't you read Ginsonic's post three posts back?  That's exactly the way you do it.
0
 

Author Comment

by:xbbin
ID: 6881686
Yes, I means How can I click a button to change the color to clRed, click another button change to clBlack.
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 6881724
var
  StatFontColor: TColor;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if StatFontColor = clBlack then
    StatFontColor := clRed
  else
    StatFontColor := clBlack;

  StatusBar1.Invalidate;
end;

procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar;
Panel: TStatusPanel; const Rect: TRect);
begin

 if Panel = StatusBar.Panels[1] then
 begin
   StatusBar.Canvas.Font.Color := StatFontColor;
   StatusBar.Canvas.TextOut(Rect.Left, Rect.Top, MyText' )
  end;

end;
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6881742
Was very simple :)
0
 

Author Comment

by:xbbin
ID: 6882120
Sorry, I just a delphi beginner.

Hi Drareg,
Here have some points for you: http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=delphi&qid=20279202

Hi Stuart Johnson,
Here have some points for you: http://www.experts-
exchange.com/jsp/qManageQuestion.jsp?ta=delphi&qid=20279198

Thanks, Bin
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6882266
Look like you are an Ex-Ex beginner user, too :)
Any time with pleasure. Just ask .

Regards,
Nick aka ginsonic
0
 

Expert Comment

by:DelFreak
ID: 6883165
Hey Nick! Yeah I got it. Thanks man! Works okay. I just love socket related stuff. Hehehe!


Cheers,
DelFreak
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6884766
Glad to hear that.
See you on net .
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now