public MainForm()
{
InitializeComponent();
Graphics graphics = Graphics.FromHwnd(this.Handle);
IntPtr hdc = graphics.GetHdc();
var logfont = new NativeMethods.LOGFONT() { lfCharSet = NativeMethods.DEFAULT_CHARSET };
NativeMethods.EnumFontFamiliesEx(hdc, ref logfont, new NativeMethods.FONTENUMPROC(EnumFontFamExProc), IntPtr.Zero, 0);
graphics.ReleaseHdc();
if (comboBoxFontFamily.Items.Count > 0)
{
if (comboBoxFontFamily.Items.Contains("Consolas"))
{
comboBoxFontFamily.Text = "Consolas";
}
else
{
comboBoxFontFamily.SelectedIndex = 0;
}
}
}