参考 : https://www.cnblogs.com/kuangzhenxia-416/p/11728928.html
//获取所有字体集合 System.Drawing.Text.InstalledFontCollection MyFont = new System.Drawing.Text.InstalledFontCollection(); System.Drawing.FontFamily[] list = MyFont.Families;
#include <windows.h>
#include <uxtheme.h> #include <vssym32.h> #include <stdio.h> #pragma comment(lib, "uxtheme") int main() { LOGFONTW lf = { 0 }; HTHEME hTheme = OpenThemeData(0, VSCLASS_TEXTSTYLE); if (hTheme) { if (SUCCEEDED(GetThemeFont(hTheme, 0, TEXT_BODYTEXT, 0, TMT_FONT, &lf))) { wprintf(L"System default font name is \"%ls\"\n", lf.lfFaceName);;
} CloseThemeData(hTheme); } return 0; }
//// lf.lfFaceName 0x006ffcd0 L"Microsoft YaHei UI" 正确;
转自: https://www.fournoas.com/posts/find-windows-system-default-font-name-and-font-file/
static
void
Main(
string
[] args)
{
// C#获取系统默认字体 System.Drawing.SystemFonts.DefaultFont.Name
System.Drawing.Font font =
new
System.Drawing.Font(System.Drawing.SystemFonts.DefaultFont.Name, System.Drawing.SystemFonts.DefaultFont.Size);
// 显示的是 {Name = "宋体" Size=9} ///能获取到; 但是获取的不正确
}
标签:lf,系统,System,获取,字体,font,Drawing From: https://www.cnblogs.com/enych/p/18372420