Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » How to make something like a command button move.
Closed Thread
Old 05-10-2006, 04:23 PM   #1 (permalink)
 
Newb Techie

Join Date: May 2006

Posts: 2

uyi2121

Default How to make something like a command button move.

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~
uyi2121 is offline  
Old 05-11-2006, 01:25 AM   #2 (permalink)
 
Newb Techie

Join Date: Nov 2005

Posts: 2

nobrainerdeals

Default

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.
nobrainerdeals is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On