Share via


InkAnalyzer.FindInkLeafNodes Method

Returns a ContextNodeCollection that contains all ink leaf nodes (ink leaf nodes are the ContextNode objects that contain ink strokes).

Namespace:  System.Windows.Ink
Assembly:  IAWinFX (in IAWinFX.dll)

Syntax

'Declaration
Public Function FindInkLeafNodes As ContextNodeCollection
'Usage
Dim instance As InkAnalyzer 
Dim returnValue As ContextNodeCollection 

returnValue = instance.FindInkLeafNodes()
public ContextNodeCollection FindInkLeafNodes()
public:
ContextNodeCollection^ FindInkLeafNodes()
public function FindInkLeafNodes() : ContextNodeCollection

Return Value

Type: System.Windows.Ink.ContextNodeCollection
All ink leaf nodes which include ContextNode objects that, in turn, contain ink strokes.

Remarks

Examples of ink leaf nodes are InkWordNode, InkDrawingNode, and InkBulletNode.

Leaf nodes do not contain child nodes.

Examples

The following example loops through all the ink leaf nodes of an InkAnalyzer, named theInkAnalyzer, to find the ContextNode with the lowest bottom bound. Once it finds the node with the lowest bound, it colors strokes associated with the lowest ContextNode red.

Dim lowest As Double = Double.MinValue
Dim lowestNode As ContextNode = Nothing 
Dim leafNode As ContextNode
For Each leafNode In  theInkAnalyzer.FindInkLeafNodes()
    ' Find lowest node 
    If leafNode.Location.GetBounds().Bottom > lowest Then
        lowestNode = leafNode
        lowest = leafNode.Location.GetBounds().Bottom
    End If 
    ' Set each stroke to black 
    Dim stroke As Stroke
    For Each stroke In  leafNode.Strokes
        stroke.DrawingAttributes.Color = Colors.Black
    Next stroke
Next leafNode
' Set lowest stroke to red 
If Not (lowestNode Is Nothing) Then 
    Dim stroke As Stroke
    For Each stroke In  lowestNode.Strokes
        stroke.DrawingAttributes.Color = Colors.Red
    Next stroke
End If
double lowest = double.MinValue;
ContextNode lowestNode = null;
foreach (ContextNode leafNode in theInkAnalyzer.FindInkLeafNodes())
{
    // Find lowest node 
    if (leafNode.Location.GetBounds().Bottom > lowest)
    {
        lowestNode = leafNode;
        lowest = leafNode.Location.GetBounds().Bottom;
    }
    // Set each stroke to black 
    foreach (Stroke stroke in leafNode.Strokes)
    {
        stroke.DrawingAttributes.Color = Colors.Black;
    }
}
// Set lowest stroke to red 
if (lowestNode != null)
{
    foreach (Stroke stroke in lowestNode.Strokes)
    {
        stroke.DrawingAttributes.Color = Colors.Red;
    }
}

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkAnalyzer Class

InkAnalyzer Members

FindInkLeafNodes Overload

System.Windows.Ink Namespace

InkAnalyzer.FindLeafNodes

InkAnalyzer.FindNode

InkAnalyzer.FindNodes

InkAnalyzer.FindNodesOfType