Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualirreversible

Posted 14 April 2013 - 11:40 PM

edit: I'm not really sure what you mean by screen size in your post. I'm assuming the physical screen size and/or screen resolution in my reply

The big secret to keeping a constant size of stuff on the screen is adapting your code to current DPI (dots per inch). Unfortunately, if you're on Windows (a blind assumption here), you cannot rely on built-in DPI functionality to give you accurate DPI measurements (I found absolutely no correlation between the generic 96 dpi returned by Windows and reality). Therefore the only tuly reliable way is to query the physical dimensions of the screen, eg in millimeters (you can do that in any OS, but it's most involved in Windows*) and divide them by the current resolution to get PPI (points/pixels per inch). You can then use this to scale your object to a device-inpendent constant size on any display at any resolution.

 

* I know of exactly one instance of someone having come up with the code to get the physical display size in millimeters on Windows (link above) and that's more than a  hundred lines of code


#1irreversible

Posted 14 April 2013 - 11:39 PM

The big secret to keeping a constant size of stuff on the screen is adapting your code to current DPI (dots per inch). Unfortunately, if you're on Windows (a blind assumption here), you cannot rely on built-in DPI functionality to give you accurate DPI measurements (I found absolutely no correlation between the generic 96 dpi returned by Windows and reality). Therefore the only tuly reliable way is to query the physical dimensions of the screen, eg in millimeters (you can do that in any OS, but it's most involved in Windows*) and divide them by the current resolution to get PPI (points/pixels per inch). You can then use this to scale your object to a device-inpendent constant size on any display at any resolution.

 

* I know of exactly one instance of someone having come up with the code to get the physical display size in millimeters on Windows (link above) and that's more than a  hundred lines of code


PARTNERS