How to set font of control to a system font?

  • Thread starter Thread starter Noozer
  • Start date Start date
N

Noozer

I would like the font used on one of my forms to match whichever font the
user has selected in their display properties.

For example, I want the font on my textboxes to match the "menu" font. I
want the status bar on my form to use the "tooltip" font, like the Windows
Explorer does.

I don't see any simple method to say "mytextbox.font = font.menu" or
"myStatusbar.font = font.tooltip"

I'm sure that this is simple and I'm just not seeing it. How do I do this?

....and, as a secondary question, how can my application detect if the user
alters a Windows font/color setting while my application is running?
 
I don't see any simple method to say "mytextbox.font = font.menu" or
"myStatusbar.font = font.tooltip"

I'm sure that this is simple and I'm just not seeing it. How do I do this?

Check out the System.Drawing.SystemFonts class.

...and, as a secondary question, how can my application detect if the user
alters a Windows font/color setting while my application is running?

Handle the Microsoft.Win32.SystemEvents.UserPreferenceChanged event.


Mattias
 
Back
Top