關於mouse在離開Tlable時 label的恢復原來的color的該這樣解決 (20分)

  • 主题发起人 主题发起人 poorness
  • 开始时间 开始时间
P

poorness

Unregistered / Unconfirmed
GUEST, unregistred user!
關於mouse在離開Tlable時 label的恢復原來的color的該這樣解決 <br>我記得有一個api函數,請問是那個
 
再Label的parent的onMouseMove事件里写吧!<br>[:D][:D]
 
<br>我的意思是當我的管標移到labe時變色<br>當在離開lable,label要恢覆原來的color<br>該如何寫
 
在Label的onMouseMove事件里写变色部分<br>在Label的parent的onMouseMove事件里写恢复颜色部分
 
可是我有好己個label<br>這樣不是還要一個判斷,是不是太麻煩<br>
 
为何不用一个定时嚣了!
 
D6有一个onMouseLeave事件!可以在该事件里恢复它的颜色!
 
cm_mouseEnter,cm_mouseLeave消息处理<br><br>TMy=class(TLABEl)<br><br>&nbsp; ........<br>&nbsp; protceted<br>&nbsp; &nbsp; &nbsp; procedure mouse_enter(var T: TMEssage);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;message cm_mouseEnter;<br><br><br>&nbsp; &nbsp; &nbsp; procedure mouse_leave(var T: TMEssage);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;message cm_mouseleave;<br>end;<br><br><br>&nbsp; &nbsp; &nbsp; procedure Tmy.mouse_leave(var T: TMEssage);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;message cm_mouseleave;<br>begin<br>&nbsp; color:=leave_color;<br>end;<br><br><br>&nbsp; &nbsp; &nbsp; procedure Tmy.mouse_enter(var T: TMEssage);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;message cm_mouseenter;<br>begin<br>&nbsp; color:=enter_color;<br>end;<br><br>register为组件RegisterComponent........<br>
 
procedure TForm1.Label1MouseMove(Sender: TObject; Shift: TShiftState; X,<br>&nbsp; Y: Integer);<br>begin<br>&nbsp; label1.font.color:=clRed; &nbsp;//移动时改变label颜色<br>end;<br><br>procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,<br>&nbsp; Y: Integer);<br>begin<br>&nbsp; &nbsp; label1.Font.color:=clBlue; //恢复到原来的颜色<br>end;
 
截取 mousewheel 事件!
 
后退
顶部