Font Name dropdown Customization
The Font Name dropdown of CuteEditor by default displays a predefined set of
font names. You can easily modify this default set using the following methods.
1. Edit Dropdown Configuration File (Common.config).
The dropdown configuration file (Common.config) can be found in the
/CuteEditor/Configuration/Shared folder. In dropdown configuration file you can
find the FontName element which contains the configuration information for
the Font Name dropdown within CuteEditor. By default, it contains the
following font names:
You can modify the FontName element to create your own font name list.
- <FontName>
- <item text="Arial" html="<font size=3 face='Arial'>Arial</font>">Arial</item>
- <item text="Verdana" html="<font size=3 face='Verdana'>Verdana</font>">Verdana</item>
- <item text="Comic Sans MS" html="<font size=3 face='Comic Sans MS'>Comic Sans MS</font>">Comic Sans MS</item>
- <item text="Courier" html="<font size=3 face='Courier'>Courier</font>">Courier</item>
- <item text="Georgia" html="<font size=3 face='Georgia'>Georgia</font>">Georgia</item>
- <item text="Impact" html="<font size=3 face='Arial'>Impact</font>">Impact</item>
- <item text="Lucida Console" html="<font size=3 face='Lucida Console'>Lucida Console</font>">Lucida Console</item>
- <item text="Tahoma" html="<font size=3 face='Tahoma'>Tahoma</font>">Tahoma</item>
- <item text="Times New Roman" html="<font size=3 face='Times New Roman'>Times New Roman</font>">Times New Roman</item>
- <item text="Wingdings" html="<font size=3 >Wingdings</font>">Wingdings</item>
- </FontName>
2. Programmatically Populate the Font Name
- if (!IsPostBack) {
- CuteEditor.ToolControl toolctrl=Editor1.ToolControls["FontName"];
- if(toolctrl!=null) {
- CuteEditor.RichDropDownList dropdown=(CuteEditor.RichDropDownList)toolctrl.Control;
- //the first item is the caption
- CuteEditor.RichListItem richitem=dropdown.Items[0];
- //clear the items from configuration files
- dropdown.Items.Clear();
- //add the caption
- dropdown.Items.Add(richitem);
- //add value only
- dropdown.Items.Add("Arial");
- //add text and value
- dropdown.Items.Add("Verdana","Verdana");
- //add html and text and value
- dropdown.Items.Add("<span style='font-family:Tahoma;font-size:12pt'>Tahoma</span>","Tahoma","Tahoma");
- }
- }
VB Example:
- If Not Page.IsPostBack Then
- If Not Editor1.ToolControls("FontName") Is Nothing Then
- Dim dropdown As CuteEditor.RichDropDownList
- Dim richitem As CuteEditor.RichListItem
- dropdown = DirectCast(Editor1.ToolControls("FontName").Control, CuteEditor.RichDropDownList)
- 'the first item is the caption
- richitem = dropdown.Items(0)
- 'clear the items from configuration files
- dropdown.Items.Clear()
- 'add the caption
- dropdown.Items.Add(richitem)
- 'add value only
- dropdown.Items.Add("Arial")
- 'add text and value
- dropdown.Items.Add("Verdana","Verdana")
- 'Add html and text and value
- dropdown.Items.Add("<span style='font-family:Tahoma;font-size:12pt'>Tahoma</span>", "Tahoma", "Tahoma")
- End If
- End If