Results 1 to 3 of 3

Thread: Graphics help in Visual Basic

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2020
    Posts
    2

    Graphics help in Visual Basic

    Hello all,

    I have a Windows Form App that shows a laser scan in a picture box.
    The Picture box is 442 wide by 451 tall. The scale of the box is -138 to 138 on the "X" axis and 100 to 500 on the "Z" axis.


    I can draw a rectangle on the screen but I can't figure out how to get the coordinates of the rectangle within the picture box scale.

    Any help would be greatly appreciated.

    Thanks
    Arvanoss
    Attached Images Attached Images  

  2. #2
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,142

    Re: Graphics help in Visual Basic

    Kind of depends on how you're doing your drawing.
    If you used Transform.Translate and Transform.Scale to essentially setup your coordinate system to match your drawing area, then you would be doing your drawing in that coordinate system and you can save the matrix and use it convert client area coordinates into your scale's coordinates.

    If you are doing all the scaling and offset calculations yourself, to draw the graph, then you would need to use the same math in reverse to scale the rectangle coordinates back.

    I've posted one or two examples that might be useful. I'll do a quick search and post a link once I find one, or both.

    I guess both examples I was thinking of were posted in the same post.
    Last edited by passel; Sep 24th, 2020 at 10:12 AM.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2020
    Posts
    2

    Re: Graphics help in Visual Basic

    Thank you for sharing this...Lots to go through but I think it will help with my issue.

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