傳回所指定類型的 ContextNode 物件,這些物件為所指定 ContextNode 的子代。
命名空間: Microsoft.Ink
組件: Microsoft.Ink.Analysis (在 Microsoft.Ink.Analysis.dll 中)
語法
'宣告
Public Function FindNodesOfType ( _
type As Guid, _
node As ContextNode _
) As ContextNodeCollection
'用途
Dim instance As InkAnalyzer
Dim type As Guid
Dim node As ContextNode
Dim returnValue As ContextNodeCollection
returnValue = instance.FindNodesOfType(type, _
node)
public ContextNodeCollection FindNodesOfType(
Guid type,
ContextNode node
)
public:
ContextNodeCollection^ FindNodesOfType(
Guid type,
ContextNode^ node
)
public ContextNodeCollection FindNodesOfType(
Guid type,
ContextNode node
)
public function FindNodesOfType(
type : Guid,
node : ContextNode
) : ContextNodeCollection
參數
- type
型別:System.Guid
要尋找的 ContextNode 物件類型。
- node
型別:Microsoft.Ink.ContextNode
正在搜尋其子代的 ContextNode。
傳回值
型別:Microsoft.Ink.ContextNodeCollection
所指定類型的 ContextNode 物件,這些物件為所指定 ContextNode 的子代。
範例
下列範例說明如何對 InkAnalyzer (theInkAnalyzer) 中的所有 LineNode 物件執行迴圈。它會對每一行中的所有 InkWordNode 物件執行迴圈,如果有辨識為同一個字的兩個筆墨文字節點,則會將這些文字標示為紅色。
' 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;
}
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0