有没有办法我可以获得已安装的字体作为列表(或数组,但我更喜欢List).
所以像将所有已安装的字体排列到列表中的方法一样.到目前为止,我创造了这个
List<string> fonts = new List<string>();
fonts.AddRange() //I don't know what to put in those brackets to obtain fonts.
Run Code Online (Sandbox Code Playgroud)
有人可以提供更好的方法吗?
Geo*_*ker 19
你想要这个InstalledFontCollection班级:
using System.Drawing.Text;
using (InstalledFontCollection fontsCollection = new InstalledFontCollection())
{
FontFamily[] fontFamilies = fontsCollection.Families;
List<string> fonts = new List<string>();
foreach (FontFamily font in fontFamilies)
{
fonts.Add(font.Source);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9389 次 |
| 最近记录: |