日期:2014-05-18 浏览次数:20976 次
得到系统默认字体 private FontFamily[] fontFamilys; private void GetFontFamilies() { Graphics g = this.CreateGraphics(); fontFamilys = FontFamily.GetFamilies(g); for (int i = 0; i < fontFamilys.Length; i++) { cbxFont.Items.Add(fontFamilys[i].Name); } }
------解决方案--------------------
// 通过注册表获取系统默认字体 string DefaultFontFaceName = (string)Microsoft.Win32.Registry.GetValue(@'HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows NT/CurrentVersion/GRE_Initialize', 'GUIFont.Facename', 'SimSun');
------解决方案--------------------
这是win32的api
用法类似:
[DllImport("User32.dll")]
private static extern IntPtr GetWindowDC(IntPtr hwnd);
你要查msdn,看GetStockObject是那个dll的,参数如何