How can I develop a drop-down font control ???

M

Melisa

Hi,

I am trying to list all font families in a combo box control.
But all font families does not support all font styles .

How can i get the list of all font style and font size supported by a
specific font family
like in font dialog window control ???

Please help me and reply as soon as possible.

ThankYou
 
D

Dave Sexton

Hi Melisa,

(using System.Drawing)

foreach (FontFamily family in FontFamily.Families)
{
Console.WriteLine(family.Name);
Console.WriteLine("\t\tBold={0}",
family.IsStyleAvailable(FontStyle.Bold));
Console.WriteLine("\t\tItalic={0}",
family.IsStyleAvailable(FontStyle.Italic));
Console.WriteLine("\t\tUnderline={0}",
family.IsStyleAvailable(FontStyle.Underline));
}

I'm not sure, but I think the font sizes are hard-coded. For instance, I've
chosen Arial 8 in some applications (IIRC, VS.NET) from the dialog and it's
converted to 7.5 automatically.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top