怎么获取系统的字体,遍历系统上面的字体,然后显示在DropDownList控件中?
我是在ASP。NET中需要这个功能,用C#写的。
大家帮忙。

解决方案 »

  1.   


    using System.Drawing;
    using System.Drawing.Text;.....// load the installed fonts and iterate through the collections
    InstalledFontCollection fonts = new InstalledFontCollection();
    foreach (FontFamily family in fonts.Families) // FontFamily.Families
    {
    // ensure font supports regular, bolding, underlining, and italics
    if (family.IsStyleAvailable(FontStyle.Regular & FontStyle.Bold & FontStyle.Italic & FontStyle.Underline)) 
    {
    this.yourList.Items.Add(family.Name);    //Add font name to your list
    }
    }
      

  2.   

    使用下面的集合.
    System.Drawing.Text.FontCollection
    System.Drawing.Text.InstalledFontCollection
    System.Drawing.Text.PrivateFontCollection