다음을 통해 공유


InkAnalyzer.GetNodesFromTextRange 메서드 (Int32%, Int32%)

업데이트: 2007년 11월

지정된 텍스트 범위에 속하는 ContextNode 개체가 포함된 ContextNodeCollection을 반환합니다.

네임스페이스:  System.Windows.Ink
어셈블리:  IAWinFX(IAWinFX.dll)

구문

‘선언
Public Function GetNodesFromTextRange ( _
    ByRef start As Integer, _
    ByRef length As Integer _
) As ContextNodeCollection
‘사용 방법
Dim instance As InkAnalyzer
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

매개 변수

반환 값

형식: System.Windows.Ink.ContextNodeCollection
지정된 텍스트 범위와 관련된 ContextNode 개체의 컬렉션입니다.

설명

지정된 텍스트 범위는 전체 InkAnalyzer의 인식된 문자열에 상대적이어야 합니다.

이 메서드는 텍스트 범위를 가장 가까운 단어 경계로 확장하여 start 및 length 매개 변수의 값을 수정합니다. 예를 들어 인식된 문자열이 "I am late"인 경우 start의 매개 변수 값으로 6, length의 매개 변수 값으로 1("late"의 문자 "a"에 해당)을 사용하여 이 메서드를 호출합니다. 이 메서드는 하나의 ContextNode, 즉 InkWordNode 또는 TextWordNode로 구성된 컬렉션을 반환합니다. 또한 이 예제의 메서드는 start의 값을 5로, length의 값을 4로(단어 "late"에 해당) 수정합니다.

예제

이 예제에서는 이름이 theResultsTextBox인 TextBoxText 속성을 InkAnalyzer(theInkAnalyzer)에 대한 GetRecognizedString()에서 반환된 값에서 텍스트 상자 선택 영역에 해당하는 Strokes를 표시하는 텍스트 상자 선택 영역의 새 값으로 다시 설정합니다.

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

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

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

' First, set all strokes to black
For Each theStroke As Stroke In Me.theInkAnalyzer.RootNode.Strokes
    theStroke.DrawingAttributes.Color = Colors.Black
Next theStroke

' Next, set all selected sub nodes to red
For Each theContextNode As ContextNode In selectedSubNodes
    For Each theStroke As Stroke In theContextNode.Strokes
        theStroke.DrawingAttributes.Color = Colors.Red
    Next theStroke
Next theContextNode
// Find out what's been selected in the text box
int selStart = theResultsTextBox.SelectionStart;
int selLength = theResultsTextBox.SelectionLength;

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

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

// First, set all strokes to black
foreach (Stroke theStroke
    in this.theInkAnalyzer.RootNode.Strokes)
{
    theStroke.DrawingAttributes.Color = Colors.Black;
}

// Next, set all selected sub nodes to red
foreach (ContextNode theContextNode in selectedSubNodes)
{
    foreach (Stroke theStroke in theContextNode.Strokes)
    {
        theStroke.DrawingAttributes.Color = Colors.Red;
    }
}

플랫폼

Windows Vista

.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

InkAnalyzer 클래스

InkAnalyzer 멤버

GetNodesFromTextRange 오버로드

System.Windows.Ink 네임스페이스