InkAnalyzer.FindNodesOfType, méthode (Guid, ContextNode)
Mise à jour : November 2007
Retourne les objets ContextNode de type spécifié qui sont des descendants du ContextNode spécifié.
Espace de noms : Microsoft.Ink
Assembly : Microsoft.Ink.Analysis (dans Microsoft.Ink.Analysis.dll)
Syntaxe
'Déclaration
Public Function FindNodesOfType ( _
type As Guid, _
node As ContextNode _
) As ContextNodeCollection
'Utilisation
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
Paramètres
- type
Type : System.Guid
Type des objets ContextNode à rechercher.
- node
Type : Microsoft.Ink.ContextNode
ContextNode dont les descendants sont recherchés.
Valeur de retour
Type : Microsoft.Ink.ContextNodeCollection
Objets ContextNode de type spécifié qui sont des descendants du ContextNode spécifié.
Exemples
L'exemple suivant montre comment parcourir l'ensemble des objets LineNode dans un InkAnalyzer, theInkAnalyzer. À chaque ligne, il parcourt l'ensemble des objets InkWordNode et, si deux nœuds de mot manuscrit sont reconnus comme un même mot, ceux-ci sont marqués en rouge.
' 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;
}
}
Plateformes
Windows Vista
Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.
Informations de version
.NET Framework
Pris en charge dans : 3.0