다음을 통해 공유


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 void DeleteStroke (
    Stroke stroke
)
public function DeleteStroke (
    stroke : Stroke
)
Not applicable.

Parameters

  • stroke
    The Stroke object to delete.

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.

Example

This C# example creates a sample method that uses a foreach loop to iterate through the Stroke objects contained in an Ink object, theInk. It then deletes any Stroke object that has more points than countOfPoints and returns the number of deleted Stroke objects.

public int DeleteLongerStrokes(int countOfPoints, Ink theInk)
{
    int countOfDeletedStrokes = 0;
    foreach (Stroke stroke in theInk.Strokes)
    {
        if (stroke.PacketCount > countOfPoints)
        {
            theInk.DeleteStroke(stroke);
            countOfDeletedStrokes++;
        }
    }
    return countOfDeletedStrokes;
}

This Microsoft Visual Basic.NET example creates a sample method that uses a For Each loop to iterate through the Stroke objects contained in an Ink object, theInk. It then deletes any Stroke object that has more points than countOfPoints and returns the number of deleted Stroke objects.

Public Function DeleteLongerStrokes(ByVal countOfPoints As Integer, _
ByRef theInk As Ink) As Integer
    Dim countOfDeletedStrokes As Integer
    Dim stroke As Stroke

    For Each stroke In theInk.Strokes
        If stroke.PacketCount > countOfPoints Then
            theInk.DeleteStroke(stroke)
            countOfDeletedStrokes = countOfDeletedStrokes + 1
        End If
    Next
    Return countOfDeletedStrokes
End Function

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

Ink Class
Ink Members
Microsoft.Ink Namespace
Stroke
Microsoft.Ink.Ink.DeleteStrokes
Microsoft.Ink.Ink.CreateStroke
Microsoft.Ink.Ink.CreateStrokes