How to make something like a command button move.

Status
Not open for further replies.

uyi2121

Beta member
Messages
2
Hello, I program in vb (visual basic) mostly and I was wondering what the code to make something move (eg:commandbutton,label...) but the thing is it has to move with the mouse after the user clicks on the object. If you do not know how to do this then if you do know how to find the x-position and y-position of the mouse then post that.

thanks,
~uyi2121~
 
i used to work in VB, but now in C#. But they're very similar, since they're both .NET. Check the Cursor class. It should have an X and a Y property. Those properties give you screen cordinates, you'll have to translate them to form cordinates using PointToClient. As for moving the object after a user clicks it? Off the top of my head, you would use the MouseMove event of the control itself. Use a boolean to keep track of whether a user has clicked it yet.
 
Status
Not open for further replies.
Back
Top Bottom