Hi -
I have a VB.NET application (for Win2K and later), and I'd like to ensure
that it displays properly regardless of how the user has set his DPI Setting
on his system.
1. What is the best way to detect the user's DPI setting?
I found 2 registry keys, but which is the right one to check (or is there a
better way)? The 2 keys I found are:
HKCU\Control Panel\Desktop\WindowsMetrics\AppliedDPI
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontDPI\LogPixels
I'm guessing, if checking the registry is the best approach, that the
LogPixels value is the one to check. (I've read somewhere that AppliedDPI
may not be present for all Windows versions.)
2. What is the best way to code my application to accommodate different DPI
settings?
I could 'brute-force' it by coditionally setting top/right/bottom/left for
each control, depending on the result from my question 1 (above). That
would seem to be a lot of work, would expand code size, and might affect
performance. (And it doesn't address possible custom settings.) Is there a
better way?
How are all of you handling this issue?
Thanks for your help.
- Jeff