|
-
Jan 9th, 2000, 10:13 PM
#1
Thread Starter
New Member
Is there a way to move a window by clicking somewhere else on the form, like on a picture or something, and not on the title bar? I'm pretty sure there is, i've seen other apps do it.
thanks in advance
-
Jan 9th, 2000, 10:57 PM
#2
Member
Try this:
When picture is clicked, get current mouse position( mousedown or mouseup event will give you these).
on dragdrop event, get x&y values of mouse relative to last position.
either add/subtract to x/y on form or use move method.
i don't know if there's an easier way to do it or not. hope this helps a little.
-chuck
------------------
To err is human, but to apologize frequently is embarassing.
-
Jan 9th, 2000, 11:59 PM
#3
Add a Picturebox to the Form..
Code:
Private oX As Single
Private oY As Single
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
oX = X
oY = Y
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then Move Left + (X - oX), Top + (Y - oY)
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Jan 10th, 2000, 03:41 AM
#4
Thread Starter
New Member
hot damn, well that was just too easy, thanks guys!
-
Jan 11th, 2000, 12:43 PM
#5
If you don't want to use a picturebox, you can use this:
Code:
Option Explicit
Private Declare Function ReleaseCapture Lib "user32" () As Long
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 Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call ReleaseCapture
Call SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End Sub
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
|