'-------------------------------------
'Moving a Form Without a Title Bar?
'
'Michael Koszenski
'Author - Info Keep
'www.infokeep.net
'support@infokeep.net
'-------------------------------------
This code can go on ANY OBJECT that has Mouse_Down and Mouse_Move
events. Forms, picture boxes, etc. It can also be used to move any
object by dragging on any other object. Window / object contents
are shown while dragging too!
'In the General Section...
Dim NX,NY as integer
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
'GET THE CURRENT X AND Y POSITIONS
NX = X
NY = Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
'DRAG THE FORM AROUND ON THE SCREEN
'WHILE THE LEFT BUTTON IS DOWN
If Button = 1 Then
frmSample.Left = frmSample.Left + (X - NX)
frmSample.Top = frmSample.Top + (Y - NY)
End If
End Sub
That`s it! Saves a couple pages of API code. This method also shows
the entire object contents while it`s being dragged without IE4/5 or
Windows 98 support.
The attached project was made with VB5 enterprise edition.
Downloads
In IE right-click and select 'Save Target As...' or in Netscape
right-click and select 'Save Link As...'
View Plain Text
Download Demo Project
Not Available