Декларируем API функцию:
Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long,ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function ReleaseCapture Lib "USER32" () As Long
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2
Обращение к функции:
Public Sub DragForm(frm As Form)
On Local Error Resume Next
Call ReleaseCapture
Call SendMessage(frm.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End Sub
Добавляем в событие MouseDown элемента за который мы хотим перетаскивать форму :
If Button = acLeftButton Then
Call DragForm(Me)
End If
Пример:
Private Sub ОбластьДанных_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = acLeftButton Then
Call DragForm(Me)
End If
End Sub
Ссылки по теме