RichTextBox

Object List Hierarchy Next Object

Definition:

Provides the user with the capability to enter and edit text, and to apply more advanced formatting features than its parent TextBox provides.

Icon: images/Phx00175.gif

Specialized Features:

The following table lists and describes the properties, methods, and events that are added by RichTextBox. There are no added methods:


Property Use to...


BulletIndent Indicate how much of an indent is used in a RichTextBox control when the selected text supports the bullet style(SelBullet = True).

DisableNoScroll Provide a value that specifies whether scroll bars are enabled or disabled in the RichTextBox.

FileName Specify the filename of a file that is loaded into the RichTextBox control.

HideSelection Return a value that indicates whether the currently selected text remains highlighted even after the RichTextBox control no longer has the focus.

Persistent Specifies whether or not the contents of the RichTextBox are preserved when the object is saved. If the object is being saved to an .EBO file then the RichText is saved in the .EBO file, if the object is being saved to an .ETO file then the FileName property is used to specify the file where the RichText goes, and it is updated with the current contents of the RichTextBox

SelAlignment Determines paragraph alignment for a RichTextBox control.

SelBold Determine whether or not the currently selected text in a RichTextBox control is bold.

SelBullet Determine whether the selected text or the text at the insertion point in a RichTextBox is using the bullet style.

SelCharOffset Determine whether text in the RichTextBox control is normal, superscript, or subscript. baseline is subscript.

SelColor Indicate the color of the selected text or the color of all new text in the RichTextBox control.

SelFontName Indicate the font of the specified text in the RichTextBox control.

SelFontSize Indicate the size of the font for the specified text in the RichTextBox control.

SelHangingIndent Specify the left margin setting for the first text line and subsequent text lines in specified paragraph(s) of a RichTextBox control.

SelIndent Specify the left margin setting specified paragraph(s) of a RichTextBox control.

SelItalic Determine whether or not the currently selected text in a RichTextBox control is italic.

SelRightIndent Specify the right margin setting for the specified paragraph(s) of a RichTextBox control.

SelRTF Replace the text (in .RTF format) that is currently selected in a RichTextBox control with a new string.

SelStrikeThru Determine whether or not the currently selected text in a RichTextBox control is strike through text.

SelTabCount Determine how many tabs are in the RichTextBox in addition to determining their absolute tab positions.

SelUnderLine Determine whether or not the currently selected text in a RichTextBox control is underlined.

TextRTF Replace all text in a RichTextBox control with a new string.


Method Use to...


Find Locate the specified text in the RichTextBox.

GetLineFromChar Return the number of the line that has a particular character position in a RichTextBox control.

GetSelTabs Get the tab stop position for the specified index for the selected paragraph.

LoadFile Load an .RTF file or text file into a RichTextBox control, thus replacing the contents (text and .RTF code) of the RichTextBox control.

SaveFile Save everything in a RichTextBox control to a specified file.

SelPrint Print the contents of the RichTextBox to the specified Device Context.

SetSelTabs Set the specified tab stop position to the specified value for the currently selected paragraph.

Span Used to select words in the RichTextBox, by looking forward or backward in the text for characters from the specified character set and either including those characters are excluding them as specified by the negate argument.

Upto Used to move the selection up to word boundaries in the RichTextBox, similar to the way the Span method works.


Events Use to...


RequestResize Make the RichTextBox control grow or shrink to accomodate the amount of text that it contains

SelChange Monitor the text that is under the cursor, in case you want to keep a display of the characteristics of the selection up to date.

Copied Features:

images/Phx00176.gif Properties images/Phx00177.gif Methods images/Phx00178.gif Events

Details:

The RichTextBox control provides many properties for applying formatting to all or parts of the text contained in the control. Using these properties, you can do things like change text color, make text bold or italic, and create super- and subscripts. You can also control paragraph formatting by setting the available indents . Before you can apply any of these different formatting characteristics or make any edits, you must select the text you'd like to change.

With the RichTextBox you can also open and save files in ASCII, in addition to the RTF format. The methods provided with the RichTextBox also allow you to do many things. The LoadFile and SaveFile methods, for example, allow you to read and write files directly. The SeIRTF and TextRTF allow you to drag and drop a file or part of a file from another application onto the RichTextBox control. Set the FileName property if you want to load an .RTF or text file's contents directly to the RichTextBox control. And use the SelPrint method to print all or some of the text contained in a RichTextBox control.

Because RichTextBox inherits from TextBox, applications that already use TextBoxes can easily incorporate RichTextBox controls.