Delphi 移动窗体
移动窗体
- 使用非标题栏移动窗体(在窗体中增加私有方法,如下)
procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest);
begin
DefaultHandler(msg);
if Msg.Result=HTCLIENT then
Msg.Result:=HTCAPTION;
end;
- 方法2
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if(ssLeft in Shift) then
begin
ReleaseCapture;
SendMessage(Self.Handle,WM_SYSCOMMAND,SC_MOVE+1,0);
end;
end;