如何使用C#(WinForms)在Windows 7 / XP中显示/隐藏已安装的字体 [英] How to show/hide installed fonts in Windows 7/XP using C#(WinForms)
本文介绍了如何使用C#(WinForms)在Windows 7 / XP中显示/隐藏已安装的字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们可以在Windows窗体中使用C#在Windows操作系统中显示/隐藏已安装的字体
是否有任何课程通过我们可以访问一个字体说Arial并隐藏/显示它。
我们可以通过右键单击Windows字体文件夹中的字体来手动显示/隐藏字体
Hi,
Can we show/hide installed fonts in Windows OS using C# in Windows Forms
Is there any class through which we can access a font say "Arial" and hide/show it.
We can manually show/hide a font by right click on the font in the Windows fonts folder
推荐答案
我不知道我是否理解你的问题。
如果你只想获得已安装的字体,那么来自FontCollection的类InstalledFontCollection
I don''t know if I understand your question right.
If you just want to get the installed fonts, there is a class "InstalledFontCollection" derieved from "FontCollection"
string familyName;
string familyList = "";
FontFamily[] fontFamilies;
InstalledFontCollection installedFontCollection = new InstalledFontCollection();
// Get the array of FontFamily objects.
fontFamilies = installedFontCollection.Families;
// The loop below creates a large string that is a comma-separated
// list of all font family names.
int count = fontFamilies.Length;
for (int j = 0; j < count; ++j)
{
familyName = fontFamilies[j].Name;
familyList = familyList + familyName;
familyList = familyList + ",";
}
希望这是你想知道的。
Hope this is what you wanted to know.
这篇关于如何使用C#(WinForms)在Windows 7 / XP中显示/隐藏已安装的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文