VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This Program Shows You How To Use Drag & Drop 'Only 5 Lines Of Code

by George Scott (12 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 18th October 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This Program Shows You How To Use Drag & Drop 'Only 5 Lines Of Code

Rate This Program Shows You How To Use Drag & Drop 'Only 5 Lines Of Code



'Paste This Code In To The Code Window
'Add A CommandButton And Name It Command1

Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Dim w As Integer, h As Integer 'This Sets h & s As Integers
w = X - Source.Width / 2 'Center's Control On mouse Pointer
h = Y - Source.Width / 2 'Center's Control On mouse Pointer
Call Source.Move(w, h) 'Calls w & h Integers
End Sub

Private Sub Form_Load()
Command1.DragMode = 1 'Enables CommandButton To Use Drag And Drop
End Sub


Download this snippet    Add to My Saved Code

This Program Shows You How To Use Drag & Drop 'Only 5 Lines Of Code Comments

No comments have been posted about This Program Shows You How To Use Drag & Drop 'Only 5 Lines Of Code. Why not be the first to post a comment about This Program Shows You How To Use Drag & Drop 'Only 5 Lines Of Code.

Post your comment

Subject:
Message:
0/1000 characters