如何編寫按住一個物件就可以拖移整個視窗表單的程式碼?
例如視窗表單中有一個CommandButton物件(名稱為\"abc\"),我想按住該物件就可以拖移整個視窗表單。
這種程式碼要怎麼寫呢?
2006-06-27 07:54:08 · 1 個解答 · 發問者 GreenTEA 3 in 電腦與網際網路 ➔ 程式設計
Dim Xx&, Yy&Private Sub abc_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then Xx = X: Yy = YEnd SubPrivate Sub abc_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then Move Left + (X - Xx), Top + (Y - Yy)End Sub
2006-06-27 08:05:57 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋