InkAnalyzer.FindNodesOfType 方法 (Guid)
返回一个 ContextNodeCollection,其中包含具有指定类型的所有 ContextNode 对象。
命名空间: System.Windows.Ink
程序集: IAWinFX(在 IAWinFX.dll 中)
语法
声明
Public Function FindNodesOfType ( _
type As Guid _
) As ContextNodeCollection
用法
Dim instance As InkAnalyzer
Dim type As Guid
Dim returnValue As ContextNodeCollection
returnValue = instance.FindNodesOfType(type)
public ContextNodeCollection FindNodesOfType(
Guid type
)
public:
ContextNodeCollection^ FindNodesOfType(
Guid type
)
public ContextNodeCollection FindNodesOfType(
Guid type
)
public function FindNodesOfType(
type : Guid
) : ContextNodeCollection
参数
- type
类型:System.Guid
返回值
类型:System.Windows.Ink.ContextNodeCollection
一个 ContextNodeCollection,其中包含具有指定类型且存储在 InkAnalyzer 的节点树中的所有 ContextNode 对象。
示例
下面的示例演示如何遍历名为 theInkAnalyzer 的 InkAnalyzer 中的所有 LineNode 对象。该示例在每行中遍历所有 InkWordNode 对象;如果有两个 inkWord 节点被识别为同一个单词,则将这两个节点标记成红色。
' 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(ContextNodeType.Line)
Dim lineNode As ContextNode
For Each lineNode In lines
Dim previousWord As InkWordNode = Nothing
For Each inkWord As InkWordNode In _
theInkAnalyzer.FindNodesOfType(ContextNodeType.InkWord, lineNode)
If Not (previousWord Is Nothing) AndAlso _
previousWord.GetRecognizedString() = inkWord.GetRecognizedString() Then
For Each stroke As Stroke In previousWord.Strokes
stroke.DrawingAttributes.Color = Colors.Red
Next stroke
For Each stroke As Stroke In inkWord.Strokes
stroke.DrawingAttributes.Color = Colors.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(ContextNodeType.Line);
foreach (ContextNode lineNode in lines)
{
InkWordNode previousWord = null;
foreach (InkWordNode inkWord in
theInkAnalyzer.FindNodesOfType(ContextNodeType.InkWord, lineNode))
{
if (previousWord != null &&
previousWord.GetRecognizedString() == inkWord.GetRecognizedString())
{
foreach (Stroke stroke in previousWord.Strokes)
stroke.DrawingAttributes.Color = Colors.Red;
foreach (Stroke stroke in inkWord.Strokes)
stroke.DrawingAttributes.Color = Colors.Red;
}
previousWord = inkWord;
}
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0