|
在一个新的Form中放入一个Panel,加入如下代码: procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); const SC_DragMove = $F012; { a magic number } begin ReleaseCapture; panel1.perform(WM_SysCommand, SC_DragMove, 0); end; /////////////////////////////////////////////procedure TForm1.Button1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); {$IFNDEF WIN32} var pt : TPoint; {$ENDIF} begin if ssCtrl in Shift then begin ReleaseCapture; SendMessage(Button1.Handle, WM_SYSCOMMAND, 61458, 0); {$IFNDEF WIN32} GetCursorPos(pt); SendMessage(Button1.Handle, WM_LBUTTONUP, MK_CONTROL, Longint(pt)); {$ENDIF} end; end; |
[浏览:
次]
|