|
-
Apr 16th, 2002, 11:12 AM
#1
?: making a window moveable
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
-
Apr 16th, 2002, 11:42 AM
#2
Hyperactive Member
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
"Today's mighty oak is just yesterday's nut,
that held its ground."
-
Apr 16th, 2002, 11:49 AM
#3
-
Apr 16th, 2002, 12:01 PM
#4
Hyperactive Member
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
"Today's mighty oak is just yesterday's nut,
that held its ground."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|