GDI+ 如何查看电脑已经安装了多少字体。
使用
InstalledFontCollection来获得电脑已经安装的字体有哪些。如图;
代码如下:
View Code
1 //查看电脑有多少字体
2 private void Form1_Paint(object sender, PaintEventArgs e)
3 {
4 FontFamily[] fontfamilys ;
5 InstalledFontCollection installedFontCollection = new InstalledFontCollection();
6 fontfamilys = installedFontCollection.Families;
7 foreach (var item in fontfamilys)
8 {
9 Console.WriteLine("fontname:{0}",item.Name);
10 }
11 }
2 private void Form1_Paint(object sender, PaintEventArgs e)
3 {
4 FontFamily[] fontfamilys ;
5 InstalledFontCollection installedFontCollection = new InstalledFontCollection();
6 fontfamilys = installedFontCollection.Families;
7 foreach (var item in fontfamilys)
8 {
9 Console.WriteLine("fontname:{0}",item.Name);
10 }
11 }