Solved

How can I format the text of the StatusBar?

Posted on 2002-03-19
16
325 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Simple Delphi Question 9 90
Dynamically Created Query 3 55
Firemonkey DbLookupComboBox equivalent ? 2 47
Twebbrowser in Fire monkey android scrolling to bottom 1 30
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…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

778 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