消息业可以,不过呢,如果窗体上有别的控件,那么鼠标移动上面,它也认为离开了窗体<br>你可以在上名做写判断看鼠标所在位置的控件-》父是不是窗体,然后判断要不要关闭<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Edit1: TEdit;<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>{ TForm1 }<br><br>procedure TForm1.CMMouseLeave(var Message: TMessage);<br>begin<br> close;<br>end;