Changing form scale to mm

  • Thread starter Thread starter vicky87.eie
  • Start date Start date
V

vicky87.eie

Hey i need to change a form's scale mode from pixels to millimeters.
Can anyone tell me how to do that?
 
Hey i need to change a form's scale mode from pixels to millimeters.
Can anyone tell me how to do that?

I don't think you can change the form's scale itself. But you can choose
the units you want to use when drawing into the form, by setting the
Graphics.PageUnit property in your paint method.

Keeping in mind, of course, that dimensional units (inches, millimeters,
twips, etc.) aren't reliable on video displays, since the OS is generally
assuming a particular real-world resolution that may or may not match the
actual physical resolution of the display.

Pete
 
Ya i actually did it by the way u mentioned only:) But i need to get
the coordinates of the location i click(mouse down) in mm. How to do
it?
 
Ya i actually did it by the way u mentioned only:) But i need to get
the coordinates of the location i click(mouse down) in mm. How to do
it?

I admit, I don't know that one off the top of my head. The page units
property is for drawing (i.e. used with the Graphics class), while mouse
events are part of the control/UI API (i.e. used with the Control class).

I realize those things seem connected, but in a lot of ways they aren't.
There might be a method you can call that would transform pixel
coordinates to millimeter coordinates without the use of a Graphics
instance, but if there is I don't know about it. And I don't think you
want to be grabbing a Graphics instance every time you need to transform
coordinates.

You may find that it makes more sense for you to handle the transformation
directly. Rather than setting the Graphics to use millimeters when you
draw, instead create a Matrix representing the transformation you want,
along with an inverse Matrix of that transformation. Then when you draw,
set the Graphics.Transform to the matrix, and when you want to map pixels
back to millimeters, used the inverse transformation directly.

If no one else is able to answer your question but you do find a method
already built in that does what you need, please follow-up here with that
information. I think I would have seen it if it exists, but there's no
guarantee...I might have missed it, and obviously it'd be a useful thing
to know. :)

Pete
 
Ya i actually did it by the way u mentioned only:) But i need to get
the coordinates of the location i click(mouse down) in mm. How to do
it?

I don't think you can. The PC has no way of telling whether it is
connected to a 15 inch LCD display, or a projector that is producing
an image 15 feet across.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top