S Sachow Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-06 #1 我希望做一个像SpeedButton的Flat效果那样的东西,要鼠标移动到该控件上<br>时控件的边框或形状发生改变,鼠标离开后又恢复原状的,<br>我用了SetCapture, GetCapture和ReleaseCapture,但效果总是不尽如人意<br>请问该怎么做?现在的主要问题是鼠标离开控件后控件不会恢复原状。
我希望做一个像SpeedButton的Flat效果那样的东西,要鼠标移动到该控件上<br>时控件的边框或形状发生改变,鼠标离开后又恢复原状的,<br>我用了SetCapture, GetCapture和ReleaseCapture,但效果总是不尽如人意<br>请问该怎么做?现在的主要问题是鼠标离开控件后控件不会恢复原状。
S SuperMMX Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-06 #2 干脆自己处理CM_MOUSEENTER, CM_MOUSELEAVE 消息吧。
A Another_eYes Unregistered / Unconfirmed GUEST, unregistred user! 2000-04-06 #5 需要自己定义事件.<br>Txxxxx = class(Txxxx)<br>private<br> FOnMouseEnter: TNotifyEvent;<br> FOnMouseLeave: TNotifyEvent;<br> procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;<br> procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;<br>published<br> property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;<br> property OnMouseLeave: TNotifyEent read FOnMouseLeave write FOnMouseLeave;<br>end<br><br>procedure Txxxxx.CMMouseEnter(var Message: TMessage);<br>begin<br> inherited;<br> if Assigned(FOnMouseEnter) then<br> FOnMouseEnter(Self);<br>end;<br><br>procedure Txxxxx.CMMouseLeave(var Message: TMessage);<br>begin<br> inherited;<br> if Assigned(FOnMouseLeave) then<br> FOnMouseLeave(Self);<br>end;
需要自己定义事件.<br>Txxxxx = class(Txxxx)<br>private<br> FOnMouseEnter: TNotifyEvent;<br> FOnMouseLeave: TNotifyEvent;<br> procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;<br> procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;<br>published<br> property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;<br> property OnMouseLeave: TNotifyEent read FOnMouseLeave write FOnMouseLeave;<br>end<br><br>procedure Txxxxx.CMMouseEnter(var Message: TMessage);<br>begin<br> inherited;<br> if Assigned(FOnMouseEnter) then<br> FOnMouseEnter(Self);<br>end;<br><br>procedure Txxxxx.CMMouseLeave(var Message: TMessage);<br>begin<br> inherited;<br> if Assigned(FOnMouseLeave) then<br> FOnMouseLeave(Self);<br>end;