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

需要引用命名空间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 );
}
posted @ 2014-02-26 20:26  zzg168  阅读(205)  评论(0编辑  收藏  举报