Freigeben über


ParagraphNode.GetNodesFromTextRange-Methode (Int32%, Int32%)

Gibt eine Auflistung von ContextNode-Nachfolgerobjekten zurück, die für den angegebenen Textbereich in der erkannten Zeichenfolge relevant sind.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)

Syntax

'Declaration
Public Function GetNodesFromTextRange ( _
    ByRef start As Integer, _
    ByRef length As Integer _
) As ContextNodeCollection
'Usage
Dim instance As ParagraphNode
Dim start As Integer
Dim length As Integer
Dim returnValue As ContextNodeCollection

returnValue = instance.GetNodesFromTextRange(start, _
    length)
public ContextNodeCollection GetNodesFromTextRange(
    ref int start,
    ref int length
)
public:
ContextNodeCollection^ GetNodesFromTextRange(
    int% start, 
    int% length
)
public ContextNodeCollection GetNodesFromTextRange(
    /** @ref */int start,
    /** @ref */int length
)
public function GetNodesFromTextRange(
    start : int, 
    length : int
) : ContextNodeCollection

Parameter

  • start
    Typ: System.Int32%
    Der Anfang des Textbereichs in der erkannten Zeichenfolge.
  • length
    Typ: System.Int32%
    Die Länge des Textbereichs in der erkannten Zeichenfolge.

Rückgabewert

Typ: Microsoft.Ink.ContextNodeCollection
Gibt die Auflistung von ContextNode-Nachfolgerobjekten zurück, die für den angegebenen Textbereich in der erkannten Zeichenfolge relevant sind.

Hinweise

Der Textbereich sollte relativ zur erkannten Zeichenfolge dieses ParagraphNode und nicht relativ zur erkannten Zeichenfolge des gesamten RootNode angegeben werden.

Beispiele

Im folgenden Beispiel wird ein TextBox, selectedResultsTextBox, erfasst, dessen Text-Eigenschaft zuvor anhand des Werts, der von GetRecognizedString für eine ParagraphNode, paragraph zurückgegeben wurde festgelegt wurde. Der Benutzer hat Text in der TextBox ausgewählt. Im Beispielcode wird die Auswahl erfasst, und die Strokes werden markiert, die dieser Auswahl entsprechen.

' Find out what's been selected in the text box
Dim selStart As Integer = selectedResultsTextBox.SelectionStart
Dim selLength As Integer = selectedResultsTextBox.SelectionLength

' Return if no text is selected.
If selLength = 0 Then
    Return
End If

' Get the nodes that correspond to that range
Dim selectedSubNodes As ContextNodeCollection = paragraph.GetNodesFromTextRange(selStart, selLength)


' Use the new start and length value to update the
' selection in the TextBox
selectedResultsTextBox.SelectionStart = selStart
selectedResultsTextBox.SelectionLength = selLength

' First, set all strokes to black
Dim inkStroke As Stroke
For Each inkStroke In paragraph.Strokes
    inkStroke.DrawingAttributes = New DrawingAttributes(Color.Black)
Next inkStroke
' Next, set all selected sub nodes to red
Dim node As ContextNode
For Each node In selectedSubNodes
    For Each inkStroke In node.Strokes
        inkStroke.DrawingAttributes = New DrawingAttributes(Color.Red)
    Next inkStroke
Next node
                    // Find out what's been selected in the text box
                    int selStart = selectedResultsTextBox.SelectionStart;
                    int selLength = selectedResultsTextBox.SelectionLength;

                    // Return if no text is selected.
                    if (selLength == 0)
                        return;

                    // Get the nodes that correspond to that range
                    ContextNodeCollection selectedSubNodes =
                            paragraph.GetNodesFromTextRange(ref selStart, ref selLength);


                    // Use the new start and length value to update the
                    // selection in the TextBox
                    selectedResultsTextBox.SelectionStart = selStart;
                    selectedResultsTextBox.SelectionLength = selLength;

                    // First, set all strokes to black
                    foreach (Stroke stroke in paragraph.Strokes)
                        stroke.DrawingAttributes =
                                    new DrawingAttributes(Color.Black);
                    // Next, set all selected sub nodes to red
                    foreach (ContextNode node in selectedSubNodes)
                    {
                        foreach (Stroke stroke in node.Strokes)
                        {
                            stroke.DrawingAttributes =
                                    new DrawingAttributes(Color.Red);
                        }
                    }

Plattformen

Windows Vista

.NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.

Versionsinformationen

.NET Framework

Unterstützt in: 3.0

Siehe auch

Referenz

ParagraphNode-Klasse

ParagraphNode-Member

GetNodesFromTextRange-Überladung

Microsoft.Ink-Namespace