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
示例
下面的示例演示如何从名为 theInkAnalyzerBase 的 InkAnalyzerBase 的 InkAnalyzerBase.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