void __fastcall TForm1::StatusBar1DrawPanel(TStatusBar *StatusBar,
TStatusPanel *Panel, const TRect &Rect)
{
if (Panel->Index==1)
{
Panel->Style=psOwnerDraw;
if(Start)
{
StatusBar1->Canvas->Pen->Color=clRed;
StatusBar1->Canvas->Brush->Color=clRed;
StatusBar1->Canvas->Ellipse(Rect.left,Rect.top,Rect.left+15,Rect.top+15);
}
else
{
StatusBar1->Canvas->Pen->Color=clBlue;
StatusBar1->Canvas->Brush->Color=clBlue;
StatusBar1->Canvas->Ellipse(Rect.left,Rect.top,Rect.left+15,Rect.top+15);
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Start=!Start;
StatusBar1->Repaint();
}
bool Start=false;//全局变量,要记得定义
Panel->Index==1你可以改为你需要的