Di bawah ini merupakan fungsi standar (menggunakan fungsi API) untuk men-drag form yang tidak memiliki Control Box.
READ MORE - Drag Form Yang Tidak Memiliki ControlBox
Option ExplicitContoh penggunaan drag form yang tidak memiliki controlbox
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Sub ReleaseCapture Lib "User32" ()
Const WM_NCLBUTTONDOWN = &HA1
Const HTCAPTION = 2
Public Sub DragForm(frm As Form)
Dim lngReturnValue As Long
Call ReleaseCapture
lngReturnValue = SendMessage(frm.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
DragForm Me
End Sub