CuteEditor for .NET

Zoom Dropdown Customization

The Zoom dropdown of CuteEditor by default displays a predefined set of zoom ratios. 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 Zoom element which contains the configuration information for the Zoom dropdown within CuteEditor. By default, it contains the following format blocks:


You can modify the Zoom element to create your own format block list.

Example:


  1. <Zoom>  
  2.     <item text="400%" value="400"></item>  
  3.     <item text="300%" value="300"></item>  
  4.     <item text="200%" value="200"></item>  
  5.     <item text="100%" value="100"></item>  
  6.     <item text="80%" value="80"></item>  
  7.     <item text="75%" value="75"></item>  
  8.     <item text="66%" value="66"></item>  
  9.     <item text="50%" value="50"></item>  
  10.     <item text="33%" value="33"></item>  
  11.     <item text="25%" value="25"></item>  
  12. </Zoom>  

Now the Zoom dropdown contains the following zoom ratios.



2. Programmatically populate the Zoom dropdown:

C# Example:

  1. if (!IsPostBack) {    
  2.    CuteEditor.ToolControl toolctrl=Editor1.ToolControls["Zoom"];    
  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 text and value    
  12.       dropdown.Items.Add("300%","300");    
  13.       dropdown.Items.Add("200%","200");    
  14.       dropdown.Items.Add("100%","100");    
  15.       dropdown.Items.Add("66%","66");   
  16.    }    
  17. }  

VB Example:


  1. If Not Page.IsPostBack Then  
  2.   If Not Editor1.ToolControls("Zoom"Is Nothing Then  
  3.       Dim dropdown As CuteEditor.RichDropDownList   
  4.       Dim richitem As CuteEditor.RichListItem   
  5.       dropdown = DirectCast(Editor1.ToolControls("Zoom").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 and value   
  13.       dropdown.Items.Add("300%","300");    
  14.       dropdown.Items.Add("200%","200");    
  15.       dropdown.Items.Add("100%","100");    
  16.       dropdown.Items.Add("66%","66");   
  17.   End If  
  18. End If