VclSkin的SpeedButton自动显示问题

使用VclSkin后在窗体上放个SpeedButton按钮,把按钮的Visible属性设置为False,在程序运行时改变按钮的Caption属性,按钮又会显示出来,虽然不能点击,可是看着别扭.下边为解决方法:

打开VclSkin代码的WinSubClass单元文件,修改如下:

procedure TSkinSpeedButton.DrawSpeedbtn( acanvas:Tcanvas; rc:TRect);
var acolor:Tcolor;
     i,n,j:integer;
     r1,TextBounds:Trect;
     TextPos: TPoint;
     GlyphPos, ClientSize, GlyphSize, TextSize: TPoint;
     TotalSize: TPoint;
     DrawStyle: Longint;
     Layout: TButtonLayout;
     NumGlyphs,margin,spacing :integer;
     bglyph: Tbitmap;
     s:string;
     font:Tfont;
     flat:boolean;
     enable:boolean;
begin
     if fsd.button=nil then exit;
     if fsd.Button.map.empty then exit;

     // 修改不可见 SpeedButton Caption 属性时会显示按钮 2009-05-12
     s:=lowercase(GetEnumProperty(gcontrol,'Visible'));
     if s = 'false' then exit;
    //添加上面两行代码 修改不可见 SpeedButton Caption 属性时会显示按钮

posted @ 2013-05-01 17:00  小天1981  阅读(196)  评论(0编辑  收藏  举报