AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 
This Site
 Search Engine
 Contact Form
 

Donate to AllAPI.net

Allowing a form control to be movable (DRAG AND DROP)

This is a tip on how to make a control movable on a form. This example demonstrates a movable picture box.

Option Explicit
Public globalX As Integer
Public globalY As Integer     

Private Sub Form_DragDrop(Source As Control, X As _
Single, Y As Single)
Picture1.Move X - globalX, Y - globalY
End Sub     

Private Sub Picture1_MouseDown(Button As Integer, _
Shift As Integer, X As Single, Y As Single)
Picture1.Drag vbBeginDrag
globalX = X
globalY = Y
End Sub     

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at http://allapi.mentalis.org/