//效果不太好<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> procedure MyMouseMove(var Message:TMessage);message WM_MOVING;<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>uses Unit2;<br><br>{$R *.DFM}<br><br>procedure TForm1.MyMouseMove(var Message: TMessage);<br>begin<br> inherited;<br> if PRECT(Message.lParam)^.Left<5 then<br> begin<br> form2.close;<br> Message.Result:=1;<br> ReleaseCapture;<br> MoveWindow(Handle,PRECT(Message.lParam)^.Left,<br> PRECT(Message.lParam)^.Top,<br> PRECT(Message.lParam)^.Right-PRECT(Message.lParam)^.Left,<br> PRECT(Message.lParam)^.Bottom-PRECT(Message.lParam)^.Top,<br> True);<br> end;<br>end;