Skip to content

Instantly share code, notes, and snippets.

@mpfund
Created November 26, 2013 10:38
Show Gist options
  • Save mpfund/7656361 to your computer and use it in GitHub Desktop.
Save mpfund/7656361 to your computer and use it in GitHub Desktop.
Usercontrol: prints all system fonts
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs e)
{
var props = typeof(System.Drawing.SystemFonts).GetProperties();
int y = 0;
foreach (var p in props)
{
if (p.PropertyType == typeof(Font))
{
var font = p.GetValue(null,null) as Font;
e.Graphics.DrawString(p.Name + " " +font.Name + " " + font.Size + "pt", font, new SolidBrush(Color.Black), new Point(0, y));
y += 20;
}
}
base.OnPaint(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment