📄 defaultcs.aspx.cs
字号:
using System;
using Telerik.WebControls.RadEditorUtils;
namespace Telerik.EditorExamplesCSharp.Editor.Examples.ServersideAPI
{
/// <summary>
/// Summary description for DefaultCS.
/// </summary>
public class DefaultCS : Telerik.QuickStart.XhtmlPage
{
protected Telerik.WebControls.RadEditor editor1;
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
// Add additional colors
editor1.Colors.Add("yellow");
editor1.Colors.Add("pink");
editor1.Colors.Add("aqua");
// Add additional css classes
editor1.CssClasses.Add("Links class ", "a.link");
editor1.CssClasses.Add("Images class ", ".img");
// Add additional language
editor1.Languages.Add("fr-FR", "French");
editor1.Languages.Add("en-US", "English");
Module radEditorStatistics = new Module("RadEditorStatistics");
radEditorStatistics.DockingZoneId = "Bottom";
Module radEditorNodeInspector = new Module("RadEditorNodeInspector");
radEditorNodeInspector.DockingZoneId = "Module";
// Add additional modules
editor1.Modules.Clear();
editor1.Modules.Add(radEditorStatistics);
editor1.Modules.Add(radEditorNodeInspector);
// Add additional context menus
ContextMenu ImgContextMenu = new ContextMenu("LI");
ImgContextMenu.Tools.Add(new ToolbarButton("Cut"));
ImgContextMenu.Tools.Add(new ToolbarButton("Copy"));
ImgContextMenu.Tools.Add(new ToolbarButton("Paste"));
editor1.ContextMenus.Add(ImgContextMenu);
// Add additional fonts
editor1.FontNames.Add("Arial");
editor1.FontNames.Add("Arial Narrow");
editor1.FontNames.Add("Arial Black");
// Add additional font sizes
editor1.FontSizes.Clear();
editor1.FontSizes.Add(2);
editor1.FontSizes.Add(3);
// Add additional paragraph styles
editor1.Paragraphs.Add("Clear Formatting", "body");
editor1.Paragraphs.Add("Heading 1", "h1");
editor1.Paragraphs.Add("Heading 2", "h2");
editor1.Paragraphs.Add("Heading 3", "h3");
// Clear old symbols and add new symbols:
editor1.Symbols.Clear();
// The powerful SymbolsCollection allows you easy to add
// more than one symbol from a string or char array
editor1.Symbols.Add("€£¥©®™±≠≤≥÷×∞αβγδεζηθικλμνξοπρςστυφχψω");
// Links are now organized in a tree structure:
editor1.Links.ChildLinks.Clear();
Link myLinks = editor1.Links.Add("My Links", "");
myLinks.Add("Link 1", "http://google.com");
myLinks.Add("Link 2", "http://yahoo.com");
myLinks.Add("Link 3", "http://telerik.com");
editor1.Links["My Links"]["Link 3"].Add("r.a.d.editor", "http://www.telerik.com/r.a.d.editor/");
// Add Snippets
editor1.Snippets.Clear();
editor1.Snippets.Add("r.a.d.editor", "<table> <tr> <td> r.a.d.<b>editor</b> is the best editor out there.</td> </tr> </table>");
// Add new toolbar (dockable is enabled by default)
Telerik.WebControls.RadEditorUtils.Toolbar toolbar = new Toolbar("My Toolbar");
editor1.Toolbars.Add(toolbar);
// Add custom drop down to the new toolbar with 10 items
Telerik.WebControls.RadEditorUtils.ToolbarDropDown dropDown = new ToolbarDropDown("MyDropDown1");
for (int i = 0; i < 10; i++)
{
dropDown.Items.Add(new Telerik.WebControls.RadEditorUtils.ListItem((i + 1).ToString("Item #"), (i + 1).ToString()));
}
toolbar.Tools.Add(dropDown);
// Add one button with the standard "Bold" command
toolbar.Tools.Add(new ToolbarButton("Bold"));
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -