CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2001
    Location
    British Columbia, Canada
    Posts
    19

    (0,0) point in center?

    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.
    The more you know, the more you know you don't know.

  2. #2
    Join Date
    Jun 1999
    Location
    England
    Posts
    86

    Re: (0,0) point in center?

    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,



  3. #3
    Join Date
    Jul 2001
    Location
    British Columbia, Canada
    Posts
    19

    Thank You Andyb!

    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.
    The more you know, the more you know you don't know.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured