标签:
XPMenu是一个不错的程序界面效果控件,但它也存在不少不足之处。我最近又对它作了一点修改。
原因是我在程序里有一个ToolButton,其Style=tbsButton,当Down=True时,XPMenu绘制的效果效果跟Down=False时一样,也就是说根本看不出它是按下的。当把Style改为tbsCheck后,却能显示效果,但是底色很深。
这个按钮来我是用来表示某个面板是否可以显示的,我希望它像OfficeXP的工具按钮那样,当工具条显示时,在按钮上画个边框即可,而不是以很深的底色显示。
XPMenu绘制工具栏按钮是由TXPMenu.ToolBarDrawButton函数完成,原型为如下:
procedure TXPMenu.ToolBarDrawButton(Sender: TToolBar; Button: TToolButton; State: TCustomDrawState; var DefaultDraw: Boolean); |
if (cdsHot in State) then begin if (cdsChecked in State) or (Button.Down) or (cdsSelected in State) then ACanvas.Brush.Color := FCheckedAreaSelectColor else ACanvas.brush.color := FBSelectColor; HasBorder := true; HasBkg := true; end;
if ((cdsChecked in State) and not (cdsHot in State)) then if (cdsIndeterminate in State) and not (cdsHot in State) then |
if (cdsHot in State) then begin if (cdsChecked in State) or (Button.Down) or (cdsSelected in State) then ACanvas.Brush.Color := FCheckedAreaSelectColor else ACanvas.brush.color := FBSelectColor; HasBorder := true; HasBkg := true; end;
if ((cdsChecked in State) and not (cdsHot in State)) then {Modify: Conch 2005-3-10 在Down=true的按钮上画出边框} if (cdsIndeterminate in State) and not (cdsHot in State) then |
修改XPMenu让ToolButton在Down=True时正确显示
标签:
原文地址:http://www.cnblogs.com/findumars/p/5393783.html