관련 url : http://bdn.borland.com/article/0,1410,16664,00.html
OnDrawPanel 이벤트 핸들러에 다음처럼 작성하면 StatusBar 색상을 변경 할 수 있습니다. 그리고 각 StatusPanel의 style 프로퍼티를 psOwnerDraw로 변경하셔야 합니다.
int PanelIndex = ComboBox1->ItemIndex; //변경하고자 하는 StatusPanel 인덱스
int ColorIndex = ComboBox2->ItemIndex; //색상 인덱스
if(PanelIndex > -1 )
{
TStatusPanel *SelPanel = StatusBar1->Panels->Items[PanelIndex];
if(SelPanel == Panel)
{
TColor color = NULL;
switch (ColorIndex)
{
case 0 :
color = clRed;
break;
case 1 :
color = clBlack;
break;
case 2 :
color = clYellow;
break;
default :
color = clYellow;
break;
}
StatusBar1->Canvas->Brush->Color = color;
StatusBar1->Canvas->FillRect(Rect);
}
}
요쿠르트 님이 쓰신 글 :
:
: StatusBar의 여러 Panel중에 특정 패널의 색깔을 바꾸고 싶은데..
: 어떻게 하는지 모르겠네요..
:
: StatusBar1->Panels[1].Color= clRed; 뭐 이럴줄 알았는데..
: 아무리 찾아봐도..
: 그게 아니네요..--;
:
: 쫌 갈켜주세요..
|