Hello,
I'm writing an application which should do the following:
4 mouse clicks in a picture box (and getting the coordinates) (now I'm doing this manually with 8 textboxes)
drawing a path between this 4 points (accomplished)
calculating the configuration of 2D-robot and sending this configuration to an arduino (accomplished)
So, which event should I use?
Thanks, Tiemer
2 replies to this topic
#1
Posted 08 August 2011 - 02:31 AM
|
|
|
#2
Posted 09 August 2011 - 05:48 AM
Your problem is getting mouse coordinates from inside the picture box? On a pictureBox click event just record the values to a variable(s)
Note: the above isnt tested code, so the sytax may be off alil and I hope the math works. :P
Good Luck ~ Committed.
int x = mouse.x - pictureBox1.x; // mouse location - pictureBox location = mouse location in pictureBox. int y = mouse.y - pictureBox1.y;or
Point xy = new Point(mouse.x - pictureBox1.x , mouse.y - pictureBox1.y);
Note: the above isnt tested code, so the sytax may be off alil and I hope the math works. :P
Good Luck ~ Committed.
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.
Science is only an educated theory, which we cannot disprove.
#3
Posted 11 August 2011 - 08:52 AM
Use the MouseClick event rather than the Click event and it gives you the relative (to the picturebox) X and Y coordinates.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









