Collapse All Expand All Code: All Code: Multiple Code: C# Code: Visual Basic

C#
Visual Basic

Azuki 1.7 Documentation
WatchPattern Class
Members Example See Also Send Feedback

Text pattern to be watched and marked automatically.

Namespace: Sgry.Azuki
Assembly: Azuki (in Azuki.dll) Version: 1.7.13.40248

# Syntax

C#
    public class WatchPattern

Visual Basic
    Public Class WatchPattern

# Remarks

This class represents a text pattern which should always be watched by Azuki. By registering these watching patterns to Document.WatchPatterns, such patterns will be automatically marked by Azuki as soon as it is graphically drawn so that such patterns will be able to distinguished visually and logically too.

Most typical usage of this feature is emphasizing text patterns visually which the user is currently searching for.

# Examples

Next example code illustrates how to use WatchPattern to emphasize text search results in a document.

Firstly of all, register how the matched patterns should be decorated in initialization part.

C# | Copy
--- | ---
    // Use yellow background for the text pattern
    // which matched to the text search criteria
    // (using marking ID 30.)
    Marking.Register( new MarkingInfo(30, "Search result") );
    azukiControl.ColorScheme.SetMarkingDecoration(
            30, new BgColorTextDecoration( Color.Yellow )
        );

Secondly, update the WatchPattern every time the search criteria was changed.

C# | Copy
--- | ---
    // Show a dialog to let user input the pattern to search
    Regex pattern;
    DialogResult result = ShowFindDialog( out pattern );
    if( result != DialogResult.OK )
        return;

    // Update the text patterns to be watched
    doc.WatchPatterns.Register(
            new WatchPattern( 30, pattern )
        );

# Inheritance Hierarchy

System..::..Object
Sgry.Azuki..::..WatchPattern

# See Also

WatchPattern..::..WatchPattern Members
Sgry.Azuki Namespace