c++ builder statubar状态栏文字颜色
设置需要的panel的属性为Text为psOwnerDraw
响应StatusBar的DrawPanel事件后在代码区添加代码
void __fastcall TForm1::StatusBar1DrawPanel(TStatusBar *StatusBar,
TStatusPanel *Panel, const TRect &Rect)
{
TCanvas *pCanvas = StatusBar1->Canvas;
pCanvas->Brush->Color = clBtnText;
pCanvas->FillRect(Rect);
pCanvas->Font->Color = clLime; //改变颜色
AnsiString str = Now().FormatString(“yyyy-mm-dd hh:nn:ss”);
AnsiString ls_text=”dosftp@gmail.com 当前时间:”+str;
pCanvas->TextOut(Rect.left + 20, Rect.top + 2, ls_text);
}