I would like to create a dropdown in which the available Font names are displayed, in addition to the styles in which the font is available. Can anyone provide me with some information or code examples that I might be able to use in order to get started?
+3
A:
Call FontFamily.Families to get the collection of font families on the system, or FontFamily.GetFamilies(Graphics) to get the families for a given graphics context. Then for each font call FontFamily.IsStyleAvailable to determine support for bold, italic, etc.
itowlson
2009-09-21 12:18:07
i want exact coding for that i don't have any idea regarding this code
Yagnesh84
2009-09-21 12:57:10
+2
A:
foreach (FontFamily fontFamily in FontFamily.Families)
{
if (fontFamily.IsStyleAvailable(FontStyle.Regular))
{
fontComboBox.Items.Add(fontFamily.Name + " (Regular)");
}
if (fontFamily.IsStyleAvailable(FontStyle.Bold))
{
fontComboBox.Items.Add(fontFamily.Name + " (Bold)");
}
if (fontFamily.IsStyleAvailable(FontStyle.Italic))
{
fontComboBox.Items.Add(fontFamily.Name + " (Italic)");
}
if (fontFamily.IsStyleAvailable(FontStyle.Underline))
{
fontComboBox.Items.Add(fontFamily.Name + " (Underline)");
}
if (fontFamily.IsStyleAvailable(FontStyle.Strikeout))
{
fontComboBox.Items.Add(fontFamily.Name + " (Strikeout)");
}
}
ICR
2009-09-21 13:20:03