RichTextBox text processing control attributes

Source: Internet
Author: User

The RichTextBox Control is a text processing control that can both input text and modify text. Compared with the Textbox Control, the RichTextBox Control has more rich text processing functions, not only can the text color and font be set,
It also supports string retrieval. In addition, the RichTextBox Control can also open, modify, and store. rtf pattern files, ASCII text pattern files, and Unicode encoding pattern files.
1. Common Features
The Textbox Control described above has its own features. The RichTextBox Control basically has some other features.
(1) rightmargin features: Used to set or retrieve the size of the white space on the right, in pixels. After this feature, you can set the right white space. If you expect the right white space to be 50 pixels, you can use the following sentence:
Richtextbox1.rightmargin = richtextbox1.width-50;
(2) RTF features: used to obtain or set the text in the RichTextBox Control, including all the RTF pattern code. This feature can be used to place the RTF text in the control for display, or to obtain the RTF text in the control. This feature is usually used to exchange information between the RichTextBox Control and other RTF sources (such as Microsoft Word or Windows WordPad.

(3) selectedrtf: used to obtain or set the pattern Text of the selected RTF pattern in the control. This feature allows you to obtain the selected text in the control, including the RTF pattern code. If no text is selected at that time, assigning a value to this feature will stab the assigned text into the stabbed point. If the text is selected, the text value assigned to this feature will replace the selected text.
(4) selectioncolor features: used to obtain or set the text color at the selected text or Input Point.
(5) selectionfont: used to obtain or set the font at the selected text or entry point.
2. Common Methods
The Textbox Control described earlier has basically the RichTextBox Control. In addition, the control also has some other methods.
(1) Redo method: Used to redo the previously revoked operation. The call pattern is as follows:
RichTextBox target. Redo ()
This method has no parameters.
(2) Find method: used to find the specified string from the RichTextBox Control. The call pattern is often used as follows:
[Pattern 1]:
RichTextBox target. Find (STR)
[Function]: Search for the text in the specified "RichTextBox" control and return to find the position of the first character in the control. Assume that
If no search string is found or the search string specified by the STR parameter is null, the return value is 1.
[Pattern 2]:
RichTextBox target. Find (STR, richtextboxfinds)
[Function]: In "RichTextBox ",
Search for STR in the text box specified by "target"
The text specified in the parameter, and the first character of the returned text is
The position in the widget. If a negative value is returned, the searched text string is not found. You can also use this method to find the text of a specific pattern.
The richtextboxfinds parameter specifies the value and significance of the parameter as shown in Table 9-4 of the text search function of the security control.
.
[Pattern 3]:
RichTextBox target. Find (STR, start, richtextboxfinds)
[Function]: Find method and previous pattern 2
Similar. The difference is that the starting position of the query in the control text is set to reduce
Text Search scale. The start parameter indicates the orientation of the Start search. This function allows users to avoid text that may have been searched or are not known.
Includes the text of the specific text to be searched. If the richtextboxfinds. Reverse value is specified in the options parameter
Start Parameter
The value indicates the end of the reverse query, because the search starts from the bottom of the document.
(3) SaveFile method: This method is used to save the information in RichTextBox to a specified file. There are three calling patterns.
[Pattern 1]:
RichTextBox target name. SaveFile (File Name );
[Function]: Save the content in the RichTextBox Control as an RTF pattern file.
[Pattern 2]:
RichTextBox target name. SaveFile (file name, file type );
[Function]: Set
The content in the RichTextBox Control is saved as a pattern file specified by "file type.
[Pattern 3]:
RichTextBox target name. SaveFile (data stream, data stream type );
[Function]: Set
The content in the RichTextBox Control is saved as a data stream type file specified by "data stream type.
The values and meanings of the file type or data stream type are shown in Table 9-5.
(4) LoadFile method: the LoadFile method can be used to load text files and RTF files into the RichTextBox Control. Primary call Lattice
There are three types.
[Pattern 1]:
RichTextBox target name. LoadFile (File Name );
[Function]: loads the RTF pattern file or standard ASCII text file into the RichTextBox Control.
[Pattern 2]:
RichTextBox target name. LoadFile (data stream, data stream type );
[Function]: load the content of an existing data stream to the RichTextBox Control.
[Pattern 3]: RichTextBox target name. LoadFile (file name, file type );
[Function]: loads a specific type of file into the RichTextBox Control. Note: file type and Data Flow Pattern

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.