Fill ComboBox with List of available Fonts

后端 未结 7 2276
無奈伤痛
無奈伤痛 2020-12-10 00:29

How can I fill a combo-box with a list of all the available fonts in the system?

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-10 00:59

    You can use System.Drawing.FontFamily.Families to get the available fonts.

    List fonts = new List();
    
    foreach (FontFamily font in System.Drawing.FontFamily.Families)
    {
        fonts.Add(font.Name);
    }
    
    // add the fonts to your ComboBox here
    

提交回复
热议问题