Windows Forms Font Resize

V

vapor

I'm interested in getting a Windows forms font to resize similar to what
happens with the Windows toolbars when the end-user changes the system font.
With the Windows toolbar, the font 'grows' as the user changes the computer
settings. I'm not interested in the event that fires, what I need is an
approach to setting the font that is not hard-coded to a specific size such
as 10 or 12. I don't see that available in .NET controls, am I missing
something? For the curious, this relates to an accessibility project I am
researching.
 
B

Bob Powell [MVP]

Font sizes can be set in pixels or in points. When setting a font size all
you need to know is about how much vertical space you want the line to take
up. Remember that the font may actually take up more height than you ask for
because the measurement relates to the EM square and depending upon the
font, you may have to account for descenders and ascenders that project
outside of this area.

By default forms use an MS Sans Serif font and controls do not set a
specific value but, when the font size hasn't been set, take the font from
their parent. you may be able to use this to your advantage.

To understand the points, if you'll forgive the pun, a little better this
article may be of use. http://www.bobpowell.net/begintext.htm


--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top