本文介绍了在组合框中显示字体样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在组合框中显示所有与系统相关的字体.例如msword application

how to display all system related fontstyles in combobox .like msword application

推荐答案

public partial class Form1 : Form
{
    private class Item
    {
        public string Name;
        public string Value;
        public Item(string name, string value)
        {
            Name = name; Value = value;
        }
        public override string ToString()
        {
            return Name;
        }
    }

    public Form1()
    {
        InitializeComponent();
        foreach (System.Drawing.FontFamily f in System.Drawing.FontFamily.Families)
        {
            Item item = new Item(f.Name, f.Name);
            comboBox1.Items.Add(item);
        }
    }
}




Refreence: http://www.dotneter.com/add-fonts-into-dropdownlistcombobox [ ^ ]

希望对您有帮助!

笑一笑:)




refrence : http://www.dotneter.com/add-fonts-into-dropdownlistcombobox[^]

hope it helps!

have a smile :)



这篇关于在组合框中显示字体样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-01 03:01