public static void GetFontAndColor()
{
//使用如下命令就可以得到當前系統所有字體
InstalledFontCollection MyFont = new InstalledFontCollection();
List<FontFamily> listf = new List<FontFamily>();
FontFamily[] MyFontFamilies = MyFont.Families;
//InstalledFontCollection 對象只看得見在創建它之前安裝在 Windows 中的字體。如果用c#創建安裝字體程序要使用GDIAddFontResource 函數
InstalledFontCollection fc = new InstalledFontCollection();
foreach (FontFamily font in fc.Families)
{
listf.Add(font);
}
//獲取系統顏色預定義顏色
Array colors = System.Enum.GetValues(typeof(KnownColor));
List<KnownColor> listc = new List<KnownColor>();
foreach (KnownColor colorName in colors)
{
listc.Add(colorName);
}
}
//不要使用 InstalledFontCollection 類在 Windows 中安裝字體。而應使用 GDIAddFontResource 函數。InstalledFontCollection 對象只看得見在創建它之前安裝在 Windows 中的字體。