Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Apply system font to Windows Forms Dialog
using System;
using System.Drawing;
using System.Windows.Forms;
namespace SampleForms
{
public partial class SampleForm : Form
{
public SampleForm()
{
InitializeComponent();
ApplySystemFont();
}
private void ApplySystemFont()
{
ApplySystemFontToControl(this);
}
private static void ApplySystemFontToControl(Control control)
{
control.Font = SystemFonts.MessageBoxFont;
foreach (Control childControl in control.Controls)
{
ApplySystemFontToControl(childControl);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment