Font Name Dropdown Customization
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.
Example:
<FontName>
<item
text="Arial"
value="Arial" />
<item
text="Verdana"
value="Verdana" />
<item
text="Tahoma"
value="Tahoma" />
</FontName>
Now the Font Name dropdown contains only
Arial, Verdanda and Tahoma.
|
|
|
|
2: Programmatically Populate the Font Name
Dropdown
C# Example:
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
|
|