Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 moving a cmd box
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
tifg




PostPosted: Fri Dec 15, 2006 6:14 pm   Post subject: moving a cmd box

can someone tell me how to move a command box when you try to move your cursor over it? so when ur cursor croses a certain threshold(lets say the border of your cmd box), the cmd box itself moves in the opposite direction
Sponsor
Sponsor
Sponsor
sponsor
Silent Avenger




PostPosted: Fri Dec 15, 2006 8:04 pm   Post subject: (No subject)

One thing you should know, don't post twice in two different forums and if it's question it belongs here and not in tutorials. As for your question you'd use the mouse move event and the x, y co-ordinates to check which side the cursor came from. Also if you want to move the command button you'd use the top and left properties of the command button.
tifg




PostPosted: Sun Dec 17, 2006 3:33 pm   Post subject: (No subject)

yea my bad.. i posted there first then i realized i should have posted here...
can u maeby give me a little piece of code? cuz i dont really kno wut ur talking abt.. thnx
Silent Avenger




PostPosted: Sun Dec 17, 2006 9:12 pm   Post subject: (No subject)

Okay try this code out:
code:
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.Caption = X & "    " & Y
End Sub


Put a command button on your form (make sure it's fairly large) and put this code in. when you run the program and move your mouse over the command button you'll see the numbers appear in the command button. Make sure you record the coordinates that you get for each edge of the command button (eg. for the left side of the command button x would = 0 and y always changes) By knowing this you can construct if statements that will determine which side the mouse came from. Also the properties that you wish to modify will move the command button around the form using a grid type system so if you use the Command1.top = property it will move the command button up or down depending on the number you input, same with the Command1.left = property. Hope this helps.[/code]
tifg




PostPosted: Mon Dec 18, 2006 5:09 pm   Post subject: (No subject)

yea thanks man.. that helps alot
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: