Freigeben über


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 void SetShapeName (
    String newShapeName
)
public function SetShapeName (
    newShapeName : String
)
Not applicable.

Parameters

  • newShapeName
    The name of the shape.

Remarks

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

Example

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 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

InkDrawingNode Class
InkDrawingNode Members
System.Windows.Ink Namespace