Tstatusbar当中嵌入图片
我在StatusBar当中添加了几个panel 属性设置PsOwnerDraw 想在其中一个当中加入图片 但为什么老加不上呢 看代码
在StatusBar1DrawPanel事件中处理:
TCanvas *pcanvas = StatusBar->Canvas;
pcanvas->Font->Name = "Arial Unicode MS";
pcanvas->Font->Size=9;
switch(Panel->ID)
{
case 1:
{
pcanvas->Font->Color = clRed;
pcanvas->Draw(Rect.left+2,Rect.top+5,this->Image1->Picture->Graphic);
} break;
case 3:
{
pcanvas->Font->Name = "Tohamas";
} break;
default: break;
}
pcanvas->TextRect(Rect,Rect.Left+6,Rect.Top+4,Panel->Text);
StatusBar1->Panels->Items[1]->Style = psOwnerDraw;
void __fastcall TForm1::StatusBar1DrawPanel(TStatusBar *StatusBar,
TStatusPanel *Panel, const TRect &Rect)
{
if (Panel->Index == 1)
{
StatusBar->Canvas->Draw(1, 1, Image1->Picture->Bitmap);
}
}