Table of Contents

Property MatchingBlocks

Namespace
Alternet.Editor.TextSource
Assembly
Alternet.Editor.v9.dll

MatchingBlocks

Gets or sets IRangeList of matching begin/end blocks for Edit control.

[Browsable(false)]
public virtual IRangeList MatchingBlocks { get; set; }

Property Value

IRangeList

Examples

Here is how to use a MatchingBlocks in the C# code:

using System.Windows.Forms;

using Alternet.Editor;
using Alternet.Editor.TextSource;

public partial class Form1 : Form
{
    private TextSource textSource;
    private void Form1_Load(object sender, EventArgs e)
    {
        var syntaxEdit = new SyntaxEdit(this.components);
        textSource = new TextSource(this.components);
        textSource.LoadFile("myfile.txt");

        textSource.HighlightMatchingBlocks = true;
        syntaxEdit.Source = this.textSource;
    }

    private void Button_Click(object sender, EventArgs e)
    {
        MessageBox.Show(textSource.MatchingBlocks.Count.ToString());
    }
}

Here is how to use a MatchingBlocks in the Visual Basic code:

Imports System.Windows.Forms
Imports Alternet.Editor
Imports Alternet.Editor.TextSource

Partial Public Class Form1
    Inherits Form

    Private textSource As TextSource

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim syntaxEdit = New SyntaxEdit(Me.components)
        textSource = New TextSource(Me.components)
        textSource.LoadFile("myfile.txt")
        textSource.HighlightMatchingBlocks = True
        syntaxEdit.Source = Me.textSource
    End Sub

    Private Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)
        MessageBox.Show(textSource.MatchingBlocks.Count.ToString())
    End Sub
End Class

Remarks

Use MatchingBlocks to determine the position of the matching blocks (such as "Class" with "End Class" in Visual Basic) as the user navigates through the text.

Set HighlightMatchingBlocks property is set to true to enable highlighting of the matching blocks.