Sdílet prostřednictvím


InkDrawingNode.SetShapeName Method

Adds a new user-defined shape name for the InkDrawingNode.

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

Syntax

'Declaration
Public Sub SetShapeName ( _
    newShapeName As String _
)
'Usage
Dim instance As InkDrawingNode 
Dim newShapeName As String

instance.SetShapeName(newShapeName)
public void SetShapeName(
    string newShapeName
)
public:
void SetShapeName(
    String^ newShapeName
)
public function SetShapeName(
    newShapeName : String
)

Parameters

Remarks

After a new shape name is set, that string appears as an AnalysisAlternate for the InkDrawingNode. Setting multiple strings creates multiple alternates.

Examples

The following example looks for all the InkDrawingNode objects in an InkAnalyzer, theInkAnalyzer and sets a shape name of "Dot" to those Strokes that have bounds smaller than 200 ink units.

' Look for all InkDrawing nodes that are very small 
Dim inkDrawingNodes As ContextNodeCollection = theInkAnalyzer.FindNodesOfType(ContextNodeType.InkDrawing)
Dim inkDrawing As InkDrawingNode
For Each inkDrawing In  inkDrawingNodes
    ' Check bounding box for size 
    Dim bounds As Rect = inkDrawing.Strokes.GetBounds()
    If bounds.Width < 5 AndAlso bounds.Height < 5 Then 
        ' Set shape name
        inkDrawing.SetShapeName("Dot")
    End If 
Next inkDrawing
// Look for all InkDrawing nodes that are very small
ContextNodeCollection inkDrawingNodes =
    theInkAnalyzer.FindNodesOfType(ContextNodeType.InkDrawing);
foreach (InkDrawingNode inkDrawing in inkDrawingNodes)
{
    // Check bounding box for size
    Rect bounds = inkDrawing.Strokes.GetBounds();
    if (bounds.Width < 5 && bounds.Height < 5)
    {
        // Set shape name
        inkDrawing.SetShapeName("Dot");
    }
}

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

InkDrawingNode Class

InkDrawingNode Members

System.Windows.Ink Namespace