$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
Windows Forms RichTextBox Control
Edit rich text content with text formatting options, mail-merge, table, and floating objects, etc.
Home > WinForms UI Controls > User Manual > Tutorial of RichTextBox in C#

RichTextBox Control for C# Windows Forms

KetticRichTextBox control is capable of formatting rich text at design time and contains a variety of options for the users to edit the text and apply rich formatting options to their text content. The text formatting options include bold, italic, underline, text color and text background, bullet and numbered lists, paragraph alignment and indentation, show or hide formatting symbols, clear formatting, and more.

Format Rich Text at Design Time

KetticRichTextBox is a rich text input control, and allows the users to format the text within the same control instance. The users can also use this control as a rich text viewer. Additionally, this control contains various C# classes for the users to format the text within it, including Section, Paragraph, Span, and InlineImage. After formatting the text, the formatted text is still editable. The KetticRichTextBox .NET component provides the IsReadOnly property for the users to make the text read only. The C# code below shows how to enable the Read Only mode in C#.NET project.

ketticRichTextBox1.IsReadOnly = true;

UI for Formatting KetticRichTextBox Content

KetticRichTextBox control allows the users to edit and format the content through creating a user interface and applying the C# API included in the KetticRichTextBox .NET component. The KetticRichTextBox C# API provides the methods, including ToggleBold(), ToggleItalic(), and more, for the users to customize the text within the control for Windows Forms. The following is a C# code sample that shows how to create a user interface

private void boldButton_Click(object sender, EventArgs e)
{
this.ketticRichTextBox1.ToggleBold();
}

private void italicButton_Click(object sender, EventArgs e)
{
this.ketticRichTextBox1.ToggleItalic();
}

private void underlineButton_Click(object sender, EventArgs e)
{
this.ketticRichTextBox1.ToggleUnderline();
}
When we edit the content of KetticRichTextBox control on a position, the UI should response. For instance, the boldButton should be toggled when the caret is on a bold text. To do this, we shall handle the CurrentSpanStyleChanged event raised as the span gets changed, and customize the style of the span via the CurrentEditingStyle property in the event handler. In addition, the CurrentEditingStyle property contains GetPropertyValue() method for the users to pass the appropriate DependancyProperty to get the desired information. The C# code below demonstrates how to handle this event.

void ketticRichTextBox1_CurrentSpanStyleChanged(object sender, EventArgs e)
{
StyleDefinition style = this.ketticRichTextBox1.CurrentEditingStyle;
TextStyle fontStyle = (TextStyle)style.GetPropertyValue(Span.FontStyleProperty);
UnderlineType underlineDecoration = (UnderlineType)style.GetPropertyValue(Span.UnderlineTypeProperty);
this.boldButton.IsChecked = fontStyle.HasFlag(TextStyle.Bold);
this.italicButton.IsChecked = fontStyle.HasFlag(TextStyle.Italic);
this.underlineButton.IsChecked = underlineDecoration != UnderlineType.None;
}
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls