Drag form without title bar 
Author Message
 Drag form without title bar

Can someone tell me how to make it so I can drag a form around without having
the title bar at the top? Like, make an artificial title bar that can drag the
form around with it. Thanks.
<br>(Will Elliott)


Thu, 27 Sep 2001 03:00:00 GMT  
 Drag form without title bar
Just place this in the mousedown event of the object you would like to use
to drag the form:

Call ReleaseCapture()
Call SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)

Youll also need to declare the following:

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

--

Aqua


Quote:
> Can someone tell me how to make it so I can drag a form around without
having
> the title bar at the top? Like, make an artificial title bar that can drag
the
> form around with it. Thanks.
> <br>(Will Elliott)



Thu, 27 Sep 2001 03:00:00 GMT  
 Drag form without title bar

Quote:

>Can someone tell me how to make it so I can drag a form around without having
>the title bar at the top? Like, make an artificial title bar that can drag the
>form around with it. Thanks.
><br>(Will Elliott)

Paste the following declarations into the General Declarations section of a
form:

 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, _
    ByVal lParam As Any) As Integer
 Const WM_NCLBUTTONDOWN = &HA1
 Const HTCAPTION = 2

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y
As Single)
    ReleaseCapture
    SendMessage Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End Sub

Lee Weiner
weiner AT fuse DOT net
http://home.fuse.net/lweiner



Fri, 28 Sep 2001 03:00:00 GMT  
 Drag form without title bar

Here's a little something that should help you along
if you'd like to have the person click label or image to drag
the form simply change FORM_ to the name of the item you
wish them to grab and drag.

Paste this in the general sections of the form

dim px,py as integer

Paste this into the code section of the form

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single,
Y As Single)
px = X
py = Y
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single,
Y As Single)
If Button = 1 Then
Me.Left = Me.Left + (X - px)
Me.Top = Me.Top + (Y - py)
End If
End Sub

the pointer will remain at the spot wher they click the form and the form
will move wherever they
drag it too...

 Mike


Quote:
> Can someone tell me how to make it so I can drag a form around without
having
> the title bar at the top? Like, make an artificial title bar that can drag
the
> form around with it. Thanks.
> <br>(Will Elliott)



Mon, 01 Oct 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. drag move title without title bar?

2. Dragging a form without any title bar?

3. Dragging a form without a title bar: please help

4. Dragging Without a Title Bar?

5. How to know when the user has moved the form by dragging the title bar

6. I need a FORM without an ICON in the title bar

7. Moving a Form Without a title bar [vb3]

8. Moving a form without a title bar

9. Getting the height of the form (without title bar)

10. form move without title bar

11. Moving a FORM in VB4 without using the TITLE Bar

12. VB4: Form Without a Title Bar?

 

 
Powered by phpBB® Forum Software