Condividi tramite


ContextNode.Strokes Property

Gets the StrokeCollection associated with this ContextNode.

Namespace: System.Windows.Ink
Assembly: IAWinFX (in iawinfx.dll)
XML Namespace:  https://schemas.microsoft.com/winfx/2006/xaml/presentation

Syntax

'Declaration
Public ReadOnly Property Strokes As StrokeCollection
'Usage
Dim instance As ContextNode
Dim value As StrokeCollection

value = instance.Strokes
public StrokeCollection Strokes { get; }
public:
property StrokeCollection^ Strokes {
    StrokeCollection^ get ();
}
/** @property */
public StrokeCollection get_Strokes ()
public function get Strokes () : StrokeCollection
Not applicable.

Property Value

The StrokeCollection associated with this ContextNode.

Remarks

If the ContextNode is not a leaf node, this property returns the strokes of all its leaf descendants.

If the node is of a type that does not have strokes, such as TextWordNode, ImageNode, or AnalysisHintNode, this property returns an empty strokes collection.

Example

This example is a method that assigns a red DrawingAttributes to the strokes of a ContextNode and assigns the default drawing attributes to all other strokes. An InkCanvas, theInkCanvas, collected the strokes.

Sub MarkNodeAsRed(ByVal selectedNode As ContextNode)
    ' Set all node strokes to black, but this one to red
    Dim stroke As Stroke
    For Each stroke In Me.theInkCanvas.Strokes
        If Not (selectedNode Is Nothing) AndAlso selectedNode.Strokes.Contains(stroke) Then
            stroke.DrawingAttributes.Color = Colors.Red
        Else
            stroke.DrawingAttributes.Color = Me.theInkCanvas.DefaultDrawingAttributes.Color
        End If
    Next stroke
    
End Sub 'theResultsTreeView_SelectedItemChanged 
private void MarkNodeAsRed(ContextNode selectedNode)
{
    // Set all node strokes to black, but this one to red
    foreach (Stroke stroke in this.theInkCanvas.Strokes)
    {
        if (selectedNode != null &&
            selectedNode.Strokes.Contains(stroke))
            stroke.DrawingAttributes.Color = Colors.Red;
        else
            stroke.DrawingAttributes.Color = 
                this.theInkCanvas.DefaultDrawingAttributes.Color;
    }
}

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

ContextNode Class
ContextNode Members
System.Windows.Ink Namespace
System.Windows.Ink.StrokeCollection