andrewo
06-21-2001, 05:29 AM
Ok I have set a command button to drag(automatic)
so i click on the button and i get an outline of the button
which means i am dragging it.
My problem is when i drop it, it disapears. I want to make it so i can drag my command button and then drop it on the form.
Can you give me a very straight forward example? thanx
in the forms drag drop event you need to put <pre>source.move x,y</pre>
andrewo
06-21-2001, 06:16 AM
what drag drop event in the form?
Im not sure which one u mean can u give me the proper name?
<pre>Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X,Y
End Sub</pre>
andrewo
06-21-2001, 06:36 AM
thanx
i didnt realise it was that simple!
no problem, to get a better effect on your drag try this
<pre>Dim sngInnerX As Single
Dim sngInnerY As Single
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
sngInnerX = X
sngInnerY = Y
End Sub
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X - sngInnerX, Y - sngInnerY
End Sub[p/re]
That's pretty cool. I never used Drag & Drop because I didn't see much need for it in my applications, but if I had realized how easy it is, I may have let the user move a few buttons around and save the settings to the registry. Hmmmm....
andrewo
06-21-2001, 07:20 AM
It works great thanx. but there was one little problem that i had to remove to make it work. its was the
End Sub[p/re]
"[p/re]" part
that wasnt important was it?
no that should have been"["/pre"]" its just a tag to make the text look like code in the post
You could edit your post to show him what you mean.
andrewo check out this link to explain better markup in your posts (http://www.visualbasicforum.com/bbs/faq_english.php?Cat=#html)