Visual Basic Explorer
Visual Basic Explorer
 Navigation
 Home


 Coding
 Source Code

 FAQ Center

 VB Tips

 Downloads

 ToolBox

 Tutorials

 VB Games

 VB News

 VB Award

 VB Forums



 Affiliates
 Planet Source Code

 Rent a Coder

 DirectX4VB


 Misc
 Search

 Feedback

 Advertise

 About


Need to hire
a VB coder?

Please support our sponsor:

 Home 
 Site Map 
 Forums 
 News 
 Feedback 

 

'-------------------------------------
'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 View Plain Text
Download Demo Project Download Demo Project
View Code Online Not Available





Home | About | What's New | Source Code | FAQ | Tips & Tricks | Downloads | ToolBox | Tutorials | Game Programming | VB Award | Search | VB Forums | Feedback | VBNews | Copyright & Disclaimer | Advertise | Privacy Policy |

Quick searches: Site Search | Advanced Site Search 

Copyright 2002 by Exhedra Solutions, Inc.
By using this site you agree to its terms and conditions
VB Explorer and VBExplorer.com are trademarks of Exhedra Solutions, Inc.