共用方式為


ContextNodeBaseCollection 類別

包含 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

範例

下列範例說明如何從 InkAnalyzerBase 對 ContextNodeBaseCollection 執行迴圈。InkAnalyzerBase (theInkAnalyzerBase) 的 FindNodesOfType 方法。這個範例會對所有的行節點執行迴圈,如果同一個單字存在兩個筆墨文字節點,則會將這兩個節點標記為紅色。

' 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

執行緒安全

這個型別的任何 Public 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 命名空間