<
HTML
>
< HEAD >
< title > systemfont </ title >
< meta name ="GENERATOR" Content ="Microsoft Visual Studio .NET 7.1" >
< meta name ="CODE_LANGUAGE" Content ="C#" >
< meta name ="vs_defaultClientScript" content ="JavaScript" >
< meta name ="vs_targetSchema" content ="http://schemas.microsoft.com/intellisense/ie5" >
</ HEAD >
< body MS_POSITIONING ="GridLayout" >
< form id ="Form1" method ="post" runat ="server" >
< TABLE id ="Table1" style ="Z-INDEX: 102; LEFT: 24px; POSITION: absolute; TOP: 48px" cellSpacing ="1"
cellPadding ="1" width ="300" border ="1" >
< TR >
< TD >< FONT face ="宋体" > 系统字体列表 </ FONT ></ TD >
< TD >
< asp:DropDownList id ="DropDownList1" runat ="server" ></ asp:DropDownList ></ TD >
< TD ></ TD >
</ TR >
< TR >
< TD >< FONT face ="宋体" > 系统字体样式 </ FONT ></ TD >
< TD >< FONT face ="宋体" >
< asp:DropDownList id ="DropDownList2" runat ="server" ></ asp:DropDownList ></ FONT ></ TD >
< TD ></ TD >
</ TR >
< TR >
< TD ></ TD >
< TD ></ TD >
< TD ></ TD >
</ TR >
</ TABLE >
</ form >
</ body >
</ HTML >
< HEAD >
< title > systemfont </ title >
< meta name ="GENERATOR" Content ="Microsoft Visual Studio .NET 7.1" >
< meta name ="CODE_LANGUAGE" Content ="C#" >
< meta name ="vs_defaultClientScript" content ="JavaScript" >
< meta name ="vs_targetSchema" content ="http://schemas.microsoft.com/intellisense/ie5" >
</ HEAD >
< body MS_POSITIONING ="GridLayout" >
< form id ="Form1" method ="post" runat ="server" >
< TABLE id ="Table1" style ="Z-INDEX: 102; LEFT: 24px; POSITION: absolute; TOP: 48px" cellSpacing ="1"
cellPadding ="1" width ="300" border ="1" >
< TR >
< TD >< FONT face ="宋体" > 系统字体列表 </ FONT ></ TD >
< TD >
< asp:DropDownList id ="DropDownList1" runat ="server" ></ asp:DropDownList ></ TD >
< TD ></ TD >
</ TR >
< TR >
< TD >< FONT face ="宋体" > 系统字体样式 </ FONT ></ TD >
< TD >< FONT face ="宋体" >
< asp:DropDownList id ="DropDownList2" runat ="server" ></ asp:DropDownList ></ FONT ></ TD >
< TD ></ TD >
</ TR >
< TR >
< TD ></ TD >
< TD ></ TD >
< TD ></ TD >
</ TR >
</ TABLE >
</ form >
</ body >
</ HTML >
protected
System.Web.UI.WebControls.DropDownList DropDownList2;
protected System.Web.UI.WebControls.DropDownList DropDownList1;
private void Page_Load( object sender, System.EventArgs e)
{
//如何获得系统字体列表
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();
}
protected System.Web.UI.WebControls.DropDownList DropDownList1;
private void Page_Load( object sender, System.EventArgs e)
{
//如何获得系统字体列表
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();
}