I know that it is possible for a website to detect a user's screen dimensions in pixels, but is开发者_如何学Python there a way to detect the physical size of a user's monitor (in inches)?
This is not always possible. Even the operating system might not know this information. In order to display properly on the screen the necessary information is the resolution that the monitor can display.
Think about using a projector. Depending on how far you place the projector away from the wall, the screen will become bigger or smaller. However, the computer will send the same picture to the projector. How would the software know about the distance to the wall and hence the size of the screen?
Not reliably.
Even monitors that believe to know their DPI - which isn't many - are often incorrect.
You could use EDID from the registry.
Please vote for this suggestion: https://connect.microsoft.com/VisualStudio/feedback/details/526951/screen-object-physicalwidthincentimeters-physicalheightincentimeters-displaymode
精彩评论