c#如何获取当前系统所有的字体和颜色?
2009-12-26 20:26
549 查看
需要使用using System.Drawing.Text;
使用如下命令就可以得到当前系统所有字体
InstalledFontCollection MyFont =
new InstalledFontCollection();
FontFamily[] MyFontFamilies = MyFont.Families;
InstalledFontCollection 对象只看得见在创建它之前安装在 Windows 中的字体。如果用c#创建安装字体程序要使用GDIAddFontResource 函数
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) );
foreach( object colorName in colors )
{
ListItem tmp = new ListItem( colorName.ToString() , colorName.ToString());
this.styleColor.Items.Add( tmp );
}
使用如下命令就可以得到当前系统所有字体
InstalledFontCollection MyFont =
new InstalledFontCollection();
FontFamily[] MyFontFamilies = MyFont.Families;
InstalledFontCollection 对象只看得见在创建它之前安装在 Windows 中的字体。如果用c#创建安装字体程序要使用GDIAddFontResource 函数
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) );
foreach( object colorName in colors )
{
ListItem tmp = new ListItem( colorName.ToString() , colorName.ToString());
this.styleColor.Items.Add( tmp );
}
相关文章推荐
- c#如何获取当前系统所有的字体和颜色?
- 转载:c#如何获取当前系统所有的字体和颜色?
- C#中获取当前系统中安装的所有字体及预定义颜色
- C#中获取当前系统中安装的所有字体及预定义颜色
- C#中获取当前系统中安装的所有字体及预定义颜色
- 网页中如何获取客户端系统已安装的所有字体?
- 网页中如何获取客户端系统已安装的所有字体?
- 网页中如何获取客户端系统已安装的所有字体?
- 网页中如何获取客户端系统已安装的所有字体?
- java获取系统路径字体、得到某个目录下的所有文件名、获取当前路径
- 获取系统所有字体和当前字体
- 网页中如何获取客户端系统已安装的所有字体?
- Android Robotium测试中如何获取当前某个文本的背景颜色
- 如何获取系统当前时间
- Oracle中如何获取系统当前时间
- 如何给linux系统字体定义颜色
- Oracle中如何获取系统当前时间
- UIFont如何获取系统字体样式
- Oracle中如何获取系统当前时间
- dataGridView获取当前行ID值和设置单元格内字体颜色