![]() The text within the control can be assigned character and paragraph formatting. Text can be assigned directly to the control, or can be loaded from a rich text format (RTF) or plain text file. The control also provides more advanced formatting features than the standard TextBox control. With the RichTextBox control, the user can enter and edit text. RichTextBox1.SaveFile("C:\MyDocument.rtf", RichTextBoxStreamType.RichText) RichTextBox1.SelectionFont = New Font("Verdana", 12, FontStyle.Bold) RichTextBox1.Find("Text", RichTextBoxFinds.MatchCase) RichTextBox1.LoadFile("C:\MyDocument.rtf") RichTextBox1.SaveFile("C:\\MyDocument.rtf", RichTextBoxStreamType.RichText) RichTextBox1.SelectionFont = new Font("Verdana", 12, FontStyle.Bold) ![]() RichTextBox richTextBox1 = new RichTextBox() RichTextBox1->SaveFile( "C:\\MyDocument.rtf", RichTextBox1->SelectionColor = Color::Red RichTextBox1->SelectionFont = gcnew System::Drawing::Font( RichTextBox1->Find( "Text", RichTextBoxFinds::MatchCase ) RichTextBox1->LoadFile( "C:\\MyDocument.rtf" ) RichTextBox^ richTextBox1 = gcnew RichTextBox The example also requires that an RTF file is created, in the root of the C drive, containing the word "Text." public: ![]() This example requires that the method created in the example code is added to a Form class and called from the constructor of the form. The example code finishes by adding the control to its Form. The following code example creates a RichTextBox control that loads an RTF file into the control and searches for the first instance of the word "Text." The code then changes the font style, font size, and font color of the selected text and saves the changes back to the original file. Inherit TextBoxBase Public Class RichTextBoxĬlassInterfaceAttribute ComVisibleAttribute DockingAttribute Examples Public class RichTextBox : type RichTextBox = class In this article public ref class RichTextBox : System::Windows::Forms::TextBoxBase public class RichTextBox : Represents a Windows rich text box control.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |