给你一个例子,希望能够帮助你。。。。<br>如果对于TListBox,可能需要修改类库,或者直接派生。<br>----<br>CM_MOUSEENTER 和 CM_MOUSELEAVE。 Below 已经提供了部分使用它们的代码,<br>我试了,对TSPEEDBUTTON有效,相信对其它也有效。<br>unit SomeForm;<br>interface<br>type<br> TSomeForm = class(TForm)<br> private<br> procedure CMMouseEnter(var Msg: TMessage); message CM_MOUSEENTER;<br> procedure CMMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;<br> end;<br>implementation<br>procedure TSomeForm.CMMouseEnter(var Msg: TMessage);<br>var<br> anObject : TObject;<br>begin<br> { anObject is the control over which the mouse is right now }<br><br> anObject := TObject(Msg.lParam);<br> if anObject nil then begin<br> { First, you must find WHICH is the control under the mouse cursor, }<br> { then, determine what action to do, etc... }<br> end;<br>end;<br>procedure TSomeForm.CMMouseLeave(var Msg: TMessage);<br>begin<br> { anObject is the control which the mouse has just gone out of }<br> anObject := TObject(Msg.lParam);<br> if anObject nil then begin<br> { First, you must find WHICH is the control }<br> { the mouse cursor has just left, }<br> { then, determine what action to do, etc... }<br> end;<br>end;<br>end.<br><br>-----------<br>这样改写。。。<br>TForm1<br>TCXListBox=class(TlistBox)<br> public;<br> 把刚才上面的改改<br> private<br> procedure CMMouseEnter(var Msg: TMessage); message CM_MOUSEENTER;<br> procedure CMMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;<br> end;<br>....