다음을 통해 공유


ContextNodeBaseCollection 클래스

업데이트: 2007년 11월

잉크 분석의 결과인 ContextNodeBase 개체 컬렉션을 포함합니다.

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

구문

‘선언
Public Class ContextNodeBaseCollection _
    Implements ICollection, IEnumerable
‘사용 방법
Dim instance As ContextNodeBaseCollection
public class ContextNodeBaseCollection : ICollection, 
    IEnumerable
public ref class ContextNodeBaseCollection : ICollection, 
    IEnumerable
public class ContextNodeBaseCollection implements ICollection, 
    IEnumerable
public class ContextNodeBaseCollection implements ICollection, IEnumerable

예제

다음 예제에서는 이름이 theInkAnalyzerBase인 InkAnalyzerBaseInkAnalyzerBase.FindNodesOfType 메서드에서 ContextNodeBaseCollection을 반복하는 방법을 보여 줍니다. 또한 모든 줄 노드를 반복하고 두 개의 잉크 단어 노드가 같은 단어로 존재하면 해당 노드를 빨간색으로 표시합니다.

' If two identical ink words occur next to each other, mark them as red.
' Note: This doesn't actually look for pairs that go across two lines.
Dim lines As ContextNodeBaseCollection = _
    theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line)

For Each lineNode As ContextNodeBase In lines

    Dim previousWord As ContextNodeBase = Nothing
    Dim previousWordRecognizedString As String = ""

    For Each inkWord As ContextNodeBase In _
        theInkAnalyzerBase.FindNodesOfType(ContextNodeTypeBase.InkWord, lineNode)

        Dim inkWordRecognizedString As String = ""

        If inkWord.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString) Then
            inkWordRecognizedString = _
                CType(inkWord.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString), String)
        End If

        ' TODO: I think I can get rid of this and just assign the previous string 
        ' to the current string
        If Not previousWord Is Nothing Then

            previousWordRecognizedString = _
            CType(previousWord.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString), String)

        End If

        If previousWordRecognizedString <> "" Then

            Dim previousWordStrokes As Strokes = theInk.CreateStrokes(previousWord.GetStrokeIds())
            Dim inkWordStrokes As Strokes = theInk.CreateStrokes(previousWord.GetStrokeIds())

            For Each aStroke As Stroke In previousWordStrokes
                aStroke.DrawingAttributes = New DrawingAttributes(Color.Red)
            Next aStroke

            For Each aStroke As Stroke In inkWordStrokes
                aStroke.DrawingAttributes = New DrawingAttributes(Color.Red)
            Next aStroke
        End If

        previousWord = inkWord

    Next inkWord
Next lineNode
// If two identical ink words occur next to each other, mark them as red.
// Note: This doesn't actually look for pairs that go across two lines.
ContextNodeBaseCollection lines =
    theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line);
foreach (ContextNodeBase lineNode in lines)
{
    ContextNodeBase previousWord = null;
    string previousWordRecognizedString = "";
    foreach (ContextNodeBase inkWord in 
        theInkAnalyzerBase.FindNodesOfType(ContextNodeTypeBase.InkWord, lineNode))
    {
        string inkWordRecognizedString = "";

        if (inkWord.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString))
        {
            inkWordRecognizedString =
                (string)inkWord.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString);
        }

        // TODO: I think I can get rid of this and just assign the previous string 
        // to the current string
        if (previousWord != null &&
            previousWord.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString))
        {
            previousWordRecognizedString =
                (string)previousWord.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString);
        }

        if (previousWordRecognizedString != "" &&
            previousWordRecognizedString == inkWordRecognizedString)
        {
            Strokes previousWordStrokes = theInk.CreateStrokes(previousWord.GetStrokeIds());
            Strokes inkWordStrokes = theInk.CreateStrokes(previousWord.GetStrokeIds());

            foreach (Stroke stroke in previousWordStrokes)
                stroke.DrawingAttributes = new DrawingAttributes(Color.Red);

            foreach (Stroke stroke in inkWordStrokes)
                stroke.DrawingAttributes = new DrawingAttributes(Color.Red);
        }
        previousWord = inkWord;
    }
}

상속 계층 구조

System.Object
  System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection

스레드로부터의 안전성

이 형식의 모든 공용 static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

플랫폼

Windows Vista, Windows XP SP2, Windows Server 2003

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

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

ContextNodeBaseCollection 멤버

System.Windows.Ink.AnalysisCore 네임스페이스