Link to home
Start Free TrialLog in
Avatar of mcv22
mcv22Flag for United States of America

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.
ASKER CERTIFIED SOLUTION
Avatar of natejacobs
natejacobs

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mcv22

ASKER

Hi, I tried that ....... didn't work... any other solution?
Avatar of natejacobs
natejacobs

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?
Avatar of mcv22

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
Avatar of mcv22

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++
Avatar of mcv22

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