SetTextStyle

Description

Specifies the text formatting for selected text in a RichTextEdit control. You can make the text bold, underlined, italic, and struck out. You can also make it either a subscript or superscript.

Applies to

RichTextEdit controls

Syntax

rtename.SetTextStyle ( bold, underline, {subscript}, {superscript}, italic, strikeout )

Argument

Description

rtename

The name of the RichTextEdit control in which you want to specify formatting for selected text.

bold

A boolean value specifying whether the selected text is bold.

underline

A boolean value specifying whether the selected text is underlined.

subscript (obsolete)

Maintained for backward compatibility only. A boolean value specifying whether the selected text is a subscript. This value is currently ignored.

superscript (obsolete)

A boolean value specifying whether the selected text is a superscript. Maintained for backward compatibility only. If both subscript and superscript are true, subscript takes precedence and the text is subscripted. This value is currently ignored.

italic

A boolean value specifying whether the selected text is italic.

strikeout

A boolean value specifying whether the selected text is has a line drawn through it.


Return value

Integer.

Returns 1 if it succeeds and -1 if an error occurs.

Examples

This example makes selected text in the RichTextEdit rte_1 bold and italic:

rte_1.SetTextStyle(TRUE, FALSE, &
      TRUE, FALSE)

This example makes the selected text italic but keeps other text formatting as it was:

rte_1.SetTextStyle(rte_1.GetTextStyle(Bold!), &
      rte_1.GetTextStyle(Underlined!), &
            TRUE,
    rte_1.GetTextStyle(Strikeout!))

See also

GetTextStyle

SetSpacing

SetTextColor