Click here to Skip to main content
15,905,322 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to display all system related fontstyles in combobox .like msword application
Posted
Updated 6-Dec-11 20:44pm
v2

try this code:

C#
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);
        }
    }
}



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

hope it helps!

have a smile :)
 
Share this answer
 
Comments
satishmachineni 7-Dec-11 2:57am    
thanks for the code ,helped me alot...
D K N T H 7-Dec-11 3:04am    
mark this as solution if it helped you,

thnks
satishmachineni 7-Dec-11 3:49am    
i want to know fontstyles like bold italic...
satishmachineni 7-Dec-11 3:51am    
like msword dropdownlist
hi check this link,

http://wpf.2000things.com/tag/fonts/[^]

hope it helps

don't forget to vote

feel free to ask question!
 
Share this answer
 
Comments
satishmachineni 7-Dec-11 4:36am    
thanks for replimg me instantly,have anice day , i posted one question yesterday can u take look on that
D K N T H 7-Dec-11 4:57am    
can you give the link?
satishmachineni 7-Dec-11 5:25am    
http://www.codeproject.com/Questions/294834/how-to-add-dynammically-fontweight-to-combobox-in

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900