Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Changing form scale to mm

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
vicky87.eie@gmail.com - 06 Mar 2008 06:35 GMT
Hey i need to change a form's scale mode from pixels to millimeters.
Can anyone tell me how to do that?
Peter Duniho - 06 Mar 2008 07:25 GMT
> 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
vicky87.eie@gmail.com - 10 Mar 2008 10:36 GMT
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?
Peter Duniho - 10 Mar 2008 17:45 GMT
> 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
Martin Bonner - 11 Mar 2008 19:14 GMT
On Mar 10, 9:36 am, vicky87....@gmail.com wrote:
> 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.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.