Back to Devexpress

TextEditCustomHighlightTextEventArgs.HighlightWords(String, Color, CompareOptions) Method

windowsforms-devexpress-dot-xtraeditors-dot-texteditcustomhighlighttexteventargs-dot-highlightwords-x28-system-dot-string-system-dot-drawing-dot-color-system-dot-globalization-dot-compareoptions-x29.md

latest2.8 KB
Original Source

TextEditCustomHighlightTextEventArgs.HighlightWords(String, Color, CompareOptions) Method

Highlights whole words using a custom foreground color.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public void HighlightWords(
    string text,
    Color foreColor,
    CompareOptions options = CompareOptions.IgnoreCase
)
vb
Public Sub HighlightWords(
    text As String,
    foreColor As Color,
    options As CompareOptions = CompareOptions.IgnoreCase
)

Parameters

NameTypeDescription
textString

The text of target words.

| | foreColor | Color |

A custom foreground color used to paint the target words.

|

Optional Parameters

NameTypeDefaultDescription
optionsCompareOptionsIgnoreCase

An object that specifies text comparison settings used to locate target words.

|

Remarks

The HighlightWords method locates all whole words that match the text parameter according to the options text comparison setting. The method then paints the found words with the foreColor color.

The following characters are considered word separators:

Use the HighlightRanges methods to highlight or custom paint all occurencies of a sub-string, even if they are part of words.

See Also

TextEditCustomHighlightTextEventArgs Class

TextEditCustomHighlightTextEventArgs Members

DevExpress.XtraEditors Namespace