How to convert pixels to/from centimeters/inches?

  • Thread starter Thread starter MrPolite
  • Start date Start date
M

MrPolite

Guest
I want to see how many pixels is a centimeter/inch on my monitor, how can I do this?
I dont want to use the compatibility class.
 
OnErr0r said:
1440 twips per inch. 2.54 cm per inch.
well and how do I find that out at runtime?
let's say I'm running my app on two comps with two different screen resolutions. I need to know how many pixels each inch is on each monitor.
Dunno about twips, I dont think that would work:confused:
 
Its a constant, design or runtime makes no difference. Look at ScaleX/Y properties in the help.


Twip (1440 twips per logical inch; 567 twips per logical centimeter).
 
Pixels will vary with the screen resolution. Use Screen.TwipsPerPixelX/Y to calculate them. Your original question asked how many twips per inch/centimeter.
 
There is no Screen object in VB.NET. There is no real way of getting an accurate pixels per inch measurement, I suppose one way would be to ask the user what size monitor they're using.

[edit]
Ok, there is a Screen object but it doesn't do what you want.
[/edit]
 
Last edited:
oops, didn't notice it was the .net board.

I hate it when they alter the original question too :/
 
OnErr0r said:
oops, didn't notice it was the .net board.

I hate it when they alter the original question too :/
:)


and there HAS to be a way to do this in .NET. It would be ridiculus otherwise. There is a DpiX and DpiY property, but I couldnt make it to work
any ideas?:confused:
 
Don't bother bumping, it only irritates people. Your best bet might be what I already said, there isn't a way of getting a true measurement of pixels/inch from a screen unless you know the size of the screen.
 
Back
Top