您的位置:首页 > 编程语言 > C#

C#中获取当前系统中安装的所有字体及预定义颜色

2014-02-26 20:26 721 查看
需要引用命名空间using System.Drawing.Text;
....

//获取系统字体:
InstalledFontCollection fc = new InstalledFontCollection();
foreach( FontFamily font in fc.Families ){
ListItem tmp = new ListItem( font.Name , font.Name );
this.styleFont.Items.Add( tmp );
}
//获取系统预定义颜色:
Array colors = System.Enum.GetValues( typeof(KnownColor) );
foreachobject colorName in colors ){
ListItem tmp = new ListItem( colorName.ToString() , colorName.ToString());
this.styleColor.Items.Add( tmp );
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: