Solved

How can I format the text of the StatusBar?

Posted on 2002-03-19
16
330 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
[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
  • 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
Technology Partners: 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!

 

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
 
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

Technology Partners: 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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

729 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