hi all
i've made a form with the value "none" in the border style property, but i want my form to be moveable, i remeber someone here giving some API functions that does that, can anyone help ??
thanks in advance
Printable View
hi all
i've made a form with the value "none" in the border style property, but i want my form to be moveable, i remeber someone here giving some API functions that does that, can anyone help ??
thanks in advance
You don't even need APIs for this.
VB Code:
Dim prevX As Single, prevY As Single Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) prevX = X prevY = Y End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then Move Left - (prevX - X), Top - (prevY - Y) End Sub
Just to bring what mendhak is linking to into focus:
VB Code:
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" () Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Const WM_NCLBUTTONDOWN = &HA1 Const HTCAPTION = 2 If Button = 1 Then ReleaseCapture SendMessage Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0& End If End Sub
So you can do it either way ;)