PDA

Visualizza la versione completa : [DELPHI] Cambiare colore al testo nella StatusBar


camaleonteplus
03-10-2009, 10:13
Vorrei cambiare colore al testo che compare in questa statusbar come si fa?
StatusBar.Panels[2].Text:='Email Inviata';
ho provato con il metodo come si fa con tlabel ma non va.

Dalton
03-10-2009, 14:11
dai un occhiata qui (http://delphi.about.com/od/vclusing/a/statusbar_owner.htm)
ciao!

camaleonteplus
03-10-2009, 16:10
ho provato cosi ma dove inserisco le informazioni sul colore?

procedure TForm1.Button1Click(Sender: TObject);
begin
StatusBar1.Panels[0].Style := psOwnerDraw;
StatusBar1.Panels[1].Style := psOwnerDraw;
end;

Dalton
04-10-2009, 13:30
indichi cio' che vuoi attraverso la procedura StatusBar1DrawPanel:


procedure TStatusForm.StatusBar1DrawPanel(
StatusBar: TStatusBar;
Panel: TStatusPanel;
const Rect: TRect) ;
begin
with StatusBar.Canvas do
begin
case Panel.Index of
0: //fist panel
begin
Brush.Color := clRed;
Font.Color := clNavy;
Font.Style := [fsBold];
end;
1: //second panel
begin
Brush.Color := clYellow;
Font.Color := clTeal;
Font.Style := [fsItalic];
end;
end;
//Panel background color
FillRect(Rect) ;

//Panel Text
TextRect(Rect,2 + ImageList1.Width + Rect.Left, 2 + Rect.Top,Panel.Text) ;
end;

//draw graphics
ImageList1.Draw(StatusBar1.Canvas, Rect.Left, Rect.Top, Panel.Index) ;
end;



ciao!

camaleonteplus
04-10-2009, 20:03
Ho fatto in questo modo mi testereste il codice? A me non da risultati cioč non mi colora la StatusBar

procedure TForm1.StatusBarDrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect);
begin
with StatusBar.Canvas do
begin
case Panel.Index of
0: //Primo Pannello
begin
Brush.Color := clBtnFace;
Font.Color := clGreen;
Font.Style := [fsItalic];
end;
1: //Secondo Pannello
begin
Brush.Color := clBtnFace;
Font.Color := clGreen;
Font.Style := [fsItalic];
end;
2: //Terzo Pannello
begin
Brush.Color := clYellow;
Font.Color := clRed;
end;
3: //second panel
begin
Brush.Color := clBtnFace;
Font.Color := clNavy;
Font.Style := [fsItalic];
end;
end;
end;
end;

Loading