我的statusbar分三个panel,每个panel上有个图标,第三个panel上显示时钟。每秒更新。
我的代码如下:
procedure TfrmMain.stbar1DrawPanel(StatusBar: TStatusBar;
Panel: TStatusPanel; const Rect: TRect);
begin
if panel=stbar1.Panels[0] then
begin
imagelist3.Draw(stbar1.Canvas,rect.Left+2,rect.Top+3,2,true); stbar1.Canvas.TextOut(Rect.Left+24,rect.top+7,'当前用户:'+Fields[0].value);
close;
end;
if panel=stbar1.Panels[1] then
begin
imageList3.Draw(stbar1.Canvas,rect.Left+2,rect.Top+3,3,true);
stbar1.Canvas.Textout(rect.Left+24,rect.Top+7,'业务期:'+gsCurYear);
end;
{ if panel=stbar1.Panels[2] then
begin
imageList3.Draw(stbar1.Canvas,rect.Left+2,rect.Top+3,4,true);
stbar1.Canvas.Textout(rect.Left+24,rect.Top+7,DateTimeTostr(now));
end; }
end;
我通过TTimer来控制时间,但是我又如何同时把图标也显示出来呢?
我的代码如下:
procedure TfrmMain.stbar1DrawPanel(StatusBar: TStatusBar;
Panel: TStatusPanel; const Rect: TRect);
begin
if panel=stbar1.Panels[0] then
begin
imagelist3.Draw(stbar1.Canvas,rect.Left+2,rect.Top+3,2,true); stbar1.Canvas.TextOut(Rect.Left+24,rect.top+7,'当前用户:'+Fields[0].value);
close;
end;
if panel=stbar1.Panels[1] then
begin
imageList3.Draw(stbar1.Canvas,rect.Left+2,rect.Top+3,3,true);
stbar1.Canvas.Textout(rect.Left+24,rect.Top+7,'业务期:'+gsCurYear);
end;
{ if panel=stbar1.Panels[2] then
begin
imageList3.Draw(stbar1.Canvas,rect.Left+2,rect.Top+3,4,true);
stbar1.Canvas.Textout(rect.Left+24,rect.Top+7,DateTimeTostr(now));
end; }
end;
我通过TTimer来控制时间,但是我又如何同时把图标也显示出来呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货