Sdílet prostřednictvím


Ink.DeleteStroke Method

Deletes a Stroke object from the Ink object.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public Sub DeleteStroke ( _
    stroke As Stroke _
)
'Usage
Dim instance As Ink 
Dim stroke As Stroke

instance.DeleteStroke(stroke)
public void DeleteStroke(
    Stroke stroke
)
public:
void DeleteStroke(
    Stroke^ stroke
)
public function DeleteStroke(
    stroke : Stroke
)

Parameters

Remarks

This method deletes only a single Stroke object. To delete a Strokes collection, call the DeleteStrokes method.

This method can result in an error if called while the user is actively laying down ink.

Examples

This example creates a sample method that uses a foreach loop to iterate through the Stroke objects contained in an Ink object. It then deletes any Stroke object that has more points than maxPointCount.

Private Sub DeleteStrokesByPointCount(ByVal theInk As Ink, ByVal maxPointCount As Integer)
    ' Access to the Strokes property returns a copy of the Strokes object. 
    ' This copy must be implicitly (via using statement) or explicitly 
    ' disposed of in order to avoid a memory leak. 
    Using currentStrokes As Strokes = theInk.Strokes
        For Each S As Stroke In currentStrokes
            If S.PacketCount > maxPointCount Then
                theInk.DeleteStroke(S)
            End If 
        Next 
    End Using 
End Sub
private void DeleteStrokesByPointCount(Ink theInk, int maxPointCount)
{
    // Access to the Strokes property returns a copy of the Strokes object. 
    // This copy must be implicitly (via using statement) or explicitly 
    // disposed of in order to avoid a memory leak. 
    using (Strokes currentStrokes = theInk.Strokes)
    {
        foreach (Stroke S in currentStrokes)
        {
            if (S.PacketCount > maxPointCount)
            {
                theInk.DeleteStroke(S);
            }
        }
    }
}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

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

Ink Class

Ink Members

Microsoft.Ink Namespace

Stroke

Ink.DeleteStrokes

Ink.CreateStroke

Ink.CreateStrokes