Click to See Complete Forum and Search --> : (0,0) point in center?


Apprentice
July 16th, 2001, 02:29 PM
I have a PictureBox that I'm using as a drawing surface. The user specifies the coordinates of a line in four text boxes, presses the cmdDraw CommandButton, and the cmdDraw_Click() event uses a line method to draw the line.

So... I don't know if all that background was necessary, but the jist of my problem is that in order for the program to be intuitive for the user, I want the (0,0) point of my PictureBox to be in the center, not the upper-lefthand corner. I have no idea how to go about doing this.

Any and all help appreciated.





The more you know, the more you know you don't know.

Andyb
July 16th, 2001, 02:40 PM
Okay. 0 is the centre of the picturebox vertically and 0 is the centre of the box horizontally. Why don't you get the user to enter negative values for coordinates nearer the top than the centre and positive values for those values nearer to the bottom than the centre and so on. Now, you know that the centre vertical measurement (cvm) is picture1.height \2. Therefore if the user wants to place a coordinate at -25 then your draw command would take place at cvm - 25.

Does that make sense?

Regards,

Apprentice
July 16th, 2001, 03:20 PM
That made perfect sense. And it worked too, which is a nice bonus.





The more you know, the more you know you don't know.