mcv22
asked on
Designing applications independent of System Font Size
I'm facing a general problem while designing any application. The application is designed in Small Fonts and runs fine when the target system is running Small Fonts (96 dpi)... However, the controls are misplaced under a system running Large Fonts (120 dpi).
I want some way of detecting the system DPI setting in C# (Important) ... so that I can display a warning on runtime. If there is a way to set it through C# programatically, it would be great... I've checked out MSDN, they don't have anything on it.
I want some way of detecting the system DPI setting in C# (Important) ... so that I can display a warning on runtime. If there is a way to set it through C# programatically, it would be great... I've checked out MSDN, they don't have anything on it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I looked around for techniques to get the DPI but only found samples in C++. If you go to CodeProject.com and search for 'DPI' you'll see a number of examples.
Maybe you could use a C++ DLL in your project to make the calls?
Maybe you could use a C++ DLL in your project to make the calls?
ASKER
Yeah, I have checked code project earlier and did find what you found. How can a C++ dll be used with my project. Could you elaborate or get me a link.
Apologies, mcv, but you just found the end of my knowledge!
Suggestion: Post to the C++ forum, linking to this question.
Regards,
Nate
Suggestion: Post to the C++ forum, linking to this question.
Regards,
Nate
ASKER
The question remains open ... I would prefer a straight forward C# code, since I am not really used to importing DLLs made using C++
ASKER
Okay, AutoScale set to true and AutoScaleBaseSize checking worked. It seems AutoScaling helps only text elements, which wasnt of much help to me cause my application involves realtime graphics. So I just pop up an error message if the System Font Size is not 96 dpi.
This should help others facing this problem:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms12102002.asp
This should help others facing this problem:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms12102002.asp
ASKER