COPY过来的,你参考一下
-------------------------------
var
Form1: TForm1;
dx, dy: integer;
implementation
{$R *.dfm}
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
dx := X;
dy := y;
//close;
end;
//鼠标移动时移动窗口
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
mx, my: integer;
begin
if Shift = [ssleft] then
begin
mx := X - dx;
my := Y - dy;
Form1.Left := Form1.Left + mx;
Form1.Top := Form1.Top + my;
Form1.Caption := intToStr(X) + ':' + intToStr(Y);
end;
end;