?
Solved

Designing applications independent of System Font Size

Posted on 2005-04-13
7
Medium Priority
?
9,954 Views
Last Modified: 2013-12-03
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.
0
Comment
Question by:mcv22
  • 4
  • 3
7 Comments
 
LVL 3

Accepted Solution

by:
natejacobs earned 2000 total points
ID: 13771529
Try setting the Form's 'AutoScale' property to False.  I haven't used this property myself, but I understand it's used for exactly this scenario.

From MSDN:
"You can use this property to allow your form and its controls to automatically adjust based on changes in the font. This can be useful in applications where the font might increase or decrease based on the language specified for use by Windows.

To obtain the size the form will auto scale to, use the AutoScaleBaseSize property. If you want to determine the size the form will auto scale to based on a specific font, use the GetAutoScaleSize method."
0
 
LVL 12

Author Comment

by:mcv22
ID: 13784943
Hi, I tried that ....... didn't work... any other solution?
0
 
LVL 3

Expert Comment

by:natejacobs
ID: 13790120
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?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Author Comment

by:mcv22
ID: 13795837
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.
0
 
LVL 3

Expert Comment

by:natejacobs
ID: 13806460
Apologies, mcv, but you just found the end of my knowledge!

Suggestion:  Post to the C++ forum, linking to this question.

Regards,

Nate
0
 
LVL 12

Author Comment

by:mcv22
ID: 13837443
The question remains open ... I would prefer a straight forward C# code, since I am not really used to importing DLLs made using C++
0
 
LVL 12

Author Comment

by:mcv22
ID: 13884210
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

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month17 days, 4 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question