//给你搞定.<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> Buttons, ExtCtrls, StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> Button2: TButton;<br> procedure Button1Click(Sender: TObject);<br> procedure Button2Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br>Tmylabel=class( tlabel)<br>private<br> procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;<br> procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;<br><br>end;<br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br>var<br> img:tmylabel;<br><br>procedure Tmylabel.CMMouseEnter(var Message: TMessage);<br>begin<br> //进入事件<br>end;<br><br>procedure Tmylabel.CMMouseLeave(var Message: TMessage);<br>begin<br> //离开事件<br>end;<br><br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> img:=tmylabel.Create(self);<br> img.left:=10;<br> img.Top:=10;<br> img.Parent:=self;<br>end;