RichTextBox Control Overview (Windows Forms)
The Windows Formscontrol is used for displaying, entering, and manipulating text with formatting. The RichTextBox control does everything the control does, but it can also display fonts, colors, and links; load text and embedded images from a file; and find specified characters. The RichTextBox control is typically used to provide text manipulation and display features similar to word processing applications such as Microsoft Word. Like the TextBox control, the RichTextBox control can display scroll bars; but unlike the TextBox control, its default setting is to display both horizontal and vertical scrollbars as needed, and it has additional scrollbar settings.
As with the TextBox control, the text displayed is set by the RichTextBoxStreamType Enumeration. You can use the method to find strings of text or specific characters.property. The RichTextBox control has numerous properties to format text. For details on these properties, see and . To manipulate files, the and methods can display and write multiple file formats including plain text, Unicode plain text, and Rich Text Format (RTF). The possible file formats are listed in
You can also use a RichTextBox control for Web-style links by setting theproperty to true and writing code to handle the event. For more information, see . You can prevent the user from manipulating some or all of the text in the control by setting the property to true.
You can undo and redo most edit operations in a RichTextBox control by calling theand methods. The method enables you to determine whether the last operation the user has undone can be reapplied to the control.