|
글자를 바꾼다는 얘기는 그리기를 다시 한다고 볼 수 있습니다.
1. OnDrawPanel에 해당하는 함수를 Events에서 만듭니다.
2. TImageList를 하나 사용합니다.
3. 다음과 같이 코딩합니다.
void __fastcall TfrmMain::barStatusDrawPanel(TStatusBar *StatusBar,
TStatusPanel *Panel, const TRect &Rect)
{
TCanvas *pCanvas = StatusBar->Canvas;
if (Panel->Index==0)
{
pCanvas->FillRect(Rect);
imgStatus->Draw(pCanvas, Rect.Left, Rect.Top, 0, true);
pCanvas->TextOut(Rect.left+20, Rect.top+2, Application->Title);
}
else if (Panel->Index==1)
{
pCanvas->Brush->Color = clBlack;
pCanvas->Font->Color = clYellow;
pCanvas->Font->Style = TFontStyles() << fsBold;
pCanvas->FillRect(Rect);
imgStatus->Draw(pCanvas, Rect.Left, Rect.Top, 1, true);
pCanvas->TextOut(Rect.left+20, Rect.top+2, "Panel 1" );
}
else if (Panel->Index==2)
{
// ......
}
else
{
// ......
}
}
이상입니다.
바램 님이 쓰신 글 :
: 다음과 같이 statusbar의 글자를 바꿀려고 합니다
: statusbar에서 Panel을 2개로 나눈뒤
: 거기에 쓸 글자를 바꿀려고 다음과 같이 statusbar를 setting 했는데여..
: 바뀌지가 않는구여..
: statusbar의 property의 Font에서 바꿔도 바뀌지가 않더군여..
:
: TCanvas* pCanvas = StatusBar1->Canvas;
: pCanvas->Font->Color = clRed;
:
: StatusBar1->Panels->Items[0]->Text = nowvalue; //현재값 출력...AnsiString
: StatusBar1->Panels->Items[1]->Text = status; //그때의 상태..AnsiString..
:
: 제가 어디를 잘 못적었나요?..
:
:
:
|