由於TStatusPanel並無鼠標事件,所以只好另想辦法:
void __fastcall TForm1::StatusBar1MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
mousex=X;
}
void __fastcall TForm1::StatusBar1DblClick(TObject *Sender)
{
int i,x;
x=0;
for(i=0;i<StatusBar1->Panels->Count;i++)
{
x+=StatusBar1->Panels->Items[i]->Width;//右邊
if(mousex<x)break;
}
//此時的i已經指明了是哪個子欄
switch(i)
{
case 0:
break;
case 1:
break;
//.............
}
}