[转帖]取系统字体与格式,今天碰到找到的
System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection(); foreach (System.Drawing.FontFamily family in fonts.Families)
{
DropDownList1.Items.Add(family.Name);
}
//如何获得系统字体样式
ArrayList list=new ArrayList();
foreach(int i in Enum.GetValues(typeof(System.Drawing.FontStyle)))
{
ListItem listitem = new ListItem(Enum.GetName(typeof(System.Drawing.FontStyle),i),i.ToString());
list.Add(listitem);
}
DropDownList2.Items.Clear();
DropDownList2.DataSource=list;
DropDownList2.DataValueField="value";
DropDownList2.DataTextField="text";
DropDownList2.DataBind();