* Merge winforms framework content to working branch (#14) * Breadcrumb / TOC / Move net5 to net folder (#15) * change path from net5 to net * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Add .net 5 winforms placeholder article (#16) * added some metadata and adjusted net5 placeholder * corrections * corrections * corrections * Test1 * Swapping landing page vs concept * fix links * Fix links * Fix desc
3.5 KiB
title, ms.date, f1_keywords, helpviewer_keywords, ms.assetid
| title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | |||
|---|---|---|---|---|---|---|---|
| RichTextBox Control Overview | 03/30/2017 |
|
|
95081194-3dd4-4b84-9545-dd373e491eca |
RichTextBox Control Overview (Windows Forms)
The Windows Forms xref:System.Windows.Forms.RichTextBox control is used for displaying, entering, and manipulating text with formatting. The xref:System.Windows.Forms.RichTextBox control does everything the xref:System.Windows.Forms.TextBox control does, but it can also display fonts, colors, and links; load text and embedded images from a file; and find specified characters. The xref:System.Windows.Forms.RichTextBox control is typically used to provide text manipulation and display features similar to word processing applications such as Microsoft Word. Like the xref:System.Windows.Forms.TextBox control, the xref:System.Windows.Forms.RichTextBox control can display scroll bars; but unlike the xref:System.Windows.Forms.TextBox control, its default setting is to display both horizontal and vertical scrollbars as needed, and it has additional scrollbar settings.
Working with the RichTextBox Control
As with the xref:System.Windows.Forms.TextBox control, the text displayed is set by the xref:System.Windows.Forms.RichTextBox.Text%2A property. The xref:System.Windows.Forms.RichTextBox control has numerous properties to format text. For details on these properties, see How to: Set Font Attributes for the Windows Forms RichTextBox Control and How to: Set Indents, Hanging Indents, and Bulleted Paragraphs with the Windows Forms RichTextBox Control. To manipulate files, the xref:System.Windows.Forms.RichTextBox.LoadFile%2A and xref:System.Windows.Forms.RichTextBox.SaveFile%2A 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 xref:System.Windows.Forms.RichTextBoxStreamType. You can use the xref:System.Windows.Forms.RichTextBox.Find%2A method to find strings of text or specific characters.
You can also use a xref:System.Windows.Forms.RichTextBox control for Web-style links by setting the xref:System.Windows.Forms.RichTextBox.DetectUrls%2A property to true and writing code to handle the xref:System.Windows.Forms.RichTextBox.LinkClicked event. For more information, see How to: Display Web-Style Links with the Windows Forms RichTextBox Control. You can prevent the user from manipulating some or all of the text in the control by setting the xref:System.Windows.Forms.RichTextBox.SelectionProtected%2A property to true.
You can undo and redo most edit operations in a xref:System.Windows.Forms.RichTextBox control by calling the xref:System.Windows.Forms.TextBoxBase.Undo%2A and xref:System.Windows.Forms.RichTextBox.Redo%2A methods. The xref:System.Windows.Forms.RichTextBox.CanRedo%2A method enables you to determine whether the last operation the user has undone can be reapplied to the control.