I have a Windows Forms application where I need to make all fonts of all UI elements configurable from a separate file. I.e. I want to be able to specify that a label has a font “TitleBarBoldFont” which would resolve to a real font, depending on the current locale. The configuration file may contain a corresponding section like this:
<Font fontID="TitleBarBoldFont">
<Display facename="Helvetica" pointSize="12">
<Override lang="ja" facename="Meiryo Bold" pointSize="12"/>
<Override lang="zh" facename="SimHei" pointSize="12"/>
<Override lang="ru" facename="Arial Bold" pointSize="12"/>
</Display>
</Font>
My question is: is there a standard .NET/Windows Forms way to achieve this so that I could specify my custom fonts in the WinForms designer and wouldn’t have to explicitly call a font resolution method for each GUI element in the code?
Simplest way is to bind the font property in the Properties Window to an application setting, which will end up in the app.config file for your application.