Move and resize forms by MouseDown on any object on form.
Move and resize forms by MouseDown on any object on form.
API Declarations
Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hwnd As Long, ByVal uMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Public HTCAPTION As Long
Public Const WM_NCLBUTTONDOWN = &HA1 ' Window messages
Rate Move and resize forms by MouseDown on any object on form.
(1(1 Vote))
Create a form and insert the following code in the <object>_mousedown() subroutine:
The object can be anything. Example: create a form with a button with (default) Name: Command1
Insert the code:
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
' HTCAPTION: 2 - move window
' 10 - left resize
' 11 - right resize
' 12 - top
' 13 - left / top
' 14 - right / top
' 15 - bottom
' 16 - left / bottom
' 17 - right / bottom
HTCAPTION = 2 ' move form by clicking on object, holding the mousebutton down and moving mouse
ReleaseCapture
SendMessage Form1.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0
End Sub
Play with the value of HTCAPTION for different effects.
Have fun!
I used this for a remote winamp app.
Check out: http://www.dubb.org/
Move and resize forms by MouseDown on any object on form. Comments
No comments yet — be the first to post one!
Post a Comment