Skip to main content
All docs
V24.1

TextEditCustomHighlightTextEventArgs.HighlightRanges(String, Action<TextEdit.Block>, CompareOptions) Method

Highlights or custom paints all text blocks that have the specified content.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public void HighlightRanges(
    string text,
    Action<TextEdit.Block> settings,
    CompareOptions options = CompareOptions.IgnoreCase
)

Parameters

Name Type Description
text String

A string that identifies target text blocks to highlight or custom paint.

settings Action<TextEdit.Block>

Allows you to specify display settings or a custom painter for the text blocks.

Optional Parameters

Name Type Default Description
options CompareOptions IgnoreCase

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

Remarks

The HighlightRanges method locates all text blocks that contain the string specified by the text parameter, and then highlights or custom paints each text block according to the settings parameter. The settings parameter allows you to customize text block display options:

  • Specify the background and foreground colors.
  • Add padding.
  • Supply a painter that will paint the text. For instance, your painter can draw the text using a custom font, or display an icon or smiley.

Use the HighlightWords methods to highlight or custom paint whole words.

See Also