Finds out whether selected text has text styles (such as bold or italic) assigned to it.
RichTextEdit controls
rtename.GetTextStyle ( textstyle )
Argument |
Description |
---|---|
rtename |
The name of the RichTextEdit control in which you want to find the formatting of selected text. |
textstyle |
A value of the enumerated datatype TextStyle specifying the text style you want to check for. Values are:
|
Boolean. Returns true if the selected text is formatted with the specified text style and false if it is not. If textstyle is null, GetTextStyle returns null.
Text can be formatted with more than one text style. To test for different styles, call GetTextStyle more than once.
A previously defined structure is an instance variable istr_text for the current window. The structure contains the boolean fields: b_isBold, b_isItalic, and b_isUnderlined. This example checks whether the selected text has these styles and stores true or false values in the structure for each style:
istr_text.b_isBold = rte_fancy.GetTextStyle(Bold!)
istr_text.b_isItalic = rte_fancy.GetTextStyle(Italic!)
istr_text.b_isUnderlined = &
rte_fancy.GetTextStyle(Underlined!)