共用方式為


ContextNodeCollection 類別

包含 ContextNode 物件的集合,這些物件是筆墨分析的結果。

命名空間:  Microsoft.Ink
組件:  Microsoft.Ink.Analysis (在 Microsoft.Ink.Analysis.dll 中)

語法

'宣告
Public Class ContextNodeCollection _
    Implements ICollection, IEnumerable
'用途
Dim instance As ContextNodeCollection
public class ContextNodeCollection : ICollection, 
    IEnumerable
public ref class ContextNodeCollection : ICollection, 
    IEnumerable
public class ContextNodeCollection implements ICollection, 
    IEnumerable
public class ContextNodeCollection implements ICollection, IEnumerable

範例

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

' 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 ContextNodeCollection = _
    theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.Line)
Dim lineNode As ContextNode
Dim stroke As Stroke

For Each lineNode In lines

    Dim previousWord As InkWordNode = Nothing
    Dim inkWord As InkWordNode
    For Each inkWord In _
        theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.InkWord, lineNode)

        If Not (previousWord Is Nothing) AndAlso _
                previousWord.GetRecognizedString() = inkWord.GetRecognizedString() Then

            For Each stroke In previousWord.Strokes
                stroke.DrawingAttributes = New DrawingAttributes(Color.Red)
            Next stroke
            For Each stroke In inkWord.Strokes
                stroke.DrawingAttributes = New DrawingAttributes(Color.Red)
            Next stroke
        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.
            ContextNodeCollection lines = 
                theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.Line);
            foreach (ContextNode lineNode in lines)
            {
                InkWordNode previousWord = null;
                foreach (InkWordNode inkWord in 
                         theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.InkWord, lineNode))
                {
                    if (previousWord != null &&
                        previousWord.GetRecognizedString() == inkWord.GetRecognizedString())
                    {
                        foreach (Stroke stroke in previousWord.Strokes)
                            stroke.DrawingAttributes = new DrawingAttributes(Color.Red);
                        foreach (Stroke stroke in inkWord.Strokes)
                            stroke.DrawingAttributes = new DrawingAttributes(Color.Red);
                    }
                    previousWord = inkWord;
                }
            }

繼承階層架構

System.Object
  Microsoft.Ink.ContextNodeCollection

執行緒安全

這個型別的任何 Public static (在 Visual Basic 中為 Shared) 成員都具備執行緒安全。並非所有的執行個體成員都是安全執行緒。

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

ContextNodeCollection 成員

Microsoft.Ink 命名空間

ContextNode

FindNodes(MatchesCriteriaCallBack, Object, ContextNode)

InkAnalyzer.FindNodesOfType