Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Adding fonts to Infragistics WebHtmlEditor

5.00/5 (1 vote)
23 Mar 2011CPOL 9.7K  
Adding fonts to Infragistics WebHtmlEditor
We can add the fonts to the fonts dropdown in addition to the existing basic fonts. To add 'Times New Roman' to the font names drop down-
C#
ToolbarDropDown ddlFonts = (ToolbarDropDown)infraEditor.FindByKeyOrAction("FontName");
ddlFonts.Items.Add(new ToolbarDropDownItem("Times New Roman","Times New Roman"));

Similarly to add all the windows registered fonts-
C#
ToolbarDropDown ddlFonts = (ToolbarDropDown)infraEditor.FindByKeyOrAction("FontName");
InstalledFontCollection fonts = new InstalledFontCollection();
foreach (FontFamily family in fonts.Families)
{
    ddlFonts.Items.Add(new ToolbarDropDownItem(family.Name,family.Name));
}

License

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