i want to make my form have no borders(borderstyle = none) and i want it moveable.
Printable View
i want to make my form have no borders(borderstyle = none) and i want it moveable.
Few api calls are needed:
Code:Option Explicit
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2
Private Declare Function SendMessageLong 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 Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
ReleaseCapture
SendMessageLong Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End If
End Sub
thank you, it works perfectly.