方法一:
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
releaseCapture;
Form1.Perform(WM_SysCommand,$F017,0);
end;
procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
releaseCapture;
Form1.Perform(WM_SysCommand,$F017,0);
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
releaseCapture;
Form1.Perform(WM_SysCommand,$F017,0);
end;
方法二:
Private
procedure WMNCHitTest(Var Msg:TWMNCHitTest);Message WM_NCHITTEST;
Procedure TForm1.WMNCHitTest(Var Msg:TWMNCHitTest);
Begin
inherited;
if Msg.Result=htClient then
Msg.Result:=htCaption;
End;
方法三:
procedure tForm1.formmousedown(sender: tobject; button: tmousebutton;
shift: tshiftstate; x, y: integer);
const
sc_dragmove = $f012;
begin
releasecapture;
twincontrol(application.mainform).perform(wm_syscommand,sc_dragmove, 0);
end;