CuteEditor for .NET

Font Size Dropdown Customization

The Font Size dropdown of CuteEditor by default displays a predefined set of font Sizes. 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_Files/onfiguration/Shared folder. In dropdown configuration file you can find the FontSize element which contains the configuration information for the Font Size dropdown within Cute Editor. By default, it contains the following font sizes:

You can modify the FontSize element to create your own font size list.

Example 1.

  1. <FontSize>  
  2.       <item text="1 (8pt)" value="1" />  
  3.      <item text="2 (10pt)" value="2" />  
  4.      <item text="5 (18pt)" value="5" />  
  5. </FontSize>  

Now the Font Size dropdown contains only 1, 2 and 5.



Example 2.

  1. <FontSize>  
  2.       <item text="10px" value="10px" />  
  3.      <item text="12px" value="12px" />  
  4.      <item text="14px" value="14px" />  
  5. </FontSize>  

Now the Font Size dropdown contains only 10x, 12px and 14px.





2. Programmatically Populate the Font Size Dropdown:


C# Example:


  1. if (!IsPostBack) {    
  2.    CuteEditor.ToolControl toolctrl=Editor1.ToolControls["FontSize"];    
  3.    if(toolctrl!=null) {    
  4.       CuteEditor.RichDropDownList dropdown=(CuteEditor.RichDropDownList)toolctrl.Control;    
  5.       //the first item is the caption    
  6.       CuteEditor.RichListItem richitem=dropdown.Items[0];    
  7.       //clear the items from configuration files    
  8.       dropdown.Items.Clear();    
  9.       //add the caption    
  10.        dropdown.Items.Add(richitem);    
  11.       //add value only    
  12.       dropdown.Items.Add("1");    
  13.       //add text and value    
  14.       dropdown.Items.Add("2      (10pt)","2");    
  15.       //add html and text and value    
  16.       dropdown.Items.Add("<span style=      'font-size:18pt'>5 </span>(18pt)","5(18pt)","5");    
  17.    }    
  18. }  

VB Example:


  1. If Not Page.IsPostBack Then  
  2.   If Not Editor1.ToolControls("FontSize"Is Nothing Then  
  3.       Dim dropdown As CuteEditor.RichDropDownList   
  4.       Dim richitem As CuteEditor.RichListItem   
  5.       dropdown = DirectCast(Editor1.ToolControls("FontSize").Control, CuteEditor.RichDropDownList)   
  6.       'the first item is the caption   
  7.       richitem = dropdown.Items(0)   
  8.       'clear the items from configuration files   
  9.       dropdown.Items.Clear()   
  10.       'add the caption   
  11.       dropdown.Items.Add(richitem)   
  12.       'add value only   
  13.       dropdown.Items.Add("1")   
  14.       'add text and value   
  15.       dropdown.Items.Add("2 (10pt)","2")   
  16.       'Add html and text and value   
  17.       dropdown.Items.Add("<span style='font-size:18pt'>5 </span>(18pt)""5 (18pt)""5")   
  18.   End If  
  19. End If