Skip to main content

ToolbarFontNameEdit Class

A default toolbar editor that allows the named font to be selected and applied to the text content selected in the design view area.

Namespace: DevExpress.Web.ASPxHtmlEditor

Assembly: DevExpress.Web.ASPxHtmlEditor.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public class ToolbarFontNameEdit :
    ToolbarComboBoxBase

Remarks

The ASPxHtmlEditor allows end-users to change the font type of the editor’s selected text by using the Font Name button. Clicking this button opens a drop down window with predefined font types.

ASPxHtmlEditor-Buttons-FontType

You can add the Font Name button to toolbars by using either the ASPxHtmlEditor designer at design time, or programmatically.

protected void Page_Load(object sender, EventArgs e) {
    HtmlEditorToolbar stToolbar1 = HtmlEditorToolbar.CreateStandardToolbar1();
    ToolbarFontNameEdit fontName = new ToolbarFontNameEdit();
    ToolbarListEditItem item1 = new ToolbarListEditItem();
    item1.Text = "Times New Roman";
    item1.Value = "Times New Roman";
    ToolbarListEditItem item2 = new ToolbarListEditItem();
    item2.Text = "Tahoma";
    item2.Value = "Tahoma";
    ToolbarListEditItem item3 = new ToolbarListEditItem();
    item3.Text = "Verdana";
    item3.Value = "Verdana";
    ToolbarListEditItem item4 = new ToolbarListEditItem();
    item4.Text = "Arial";
    item4.Value = "Arial";
    ToolbarListEditItem item5 = new ToolbarListEditItem();
    item5.Text = "MS Sans Serif";
    item5.Value = "MS Sans Serif";
    ToolbarListEditItem item6 = new ToolbarListEditItem();
    item6.Text = "Courier";
    item6.Value = "Courier";
    fontName.Items.Add(item1);
    fontName.Items.Add(item2);
    fontName.Items.Add(item3);
    fontName.Items.Add(item4);
    fontName.Items.Add(item5);
    fontName.Items.Add(item6);
    stToolbar1.Items.Add(fontName);
    ASPxHtmlEditor1.Toolbars.Add(stToolbar1);
}
See Also