Share via


Strokes.Remove Method (Stroke)

Removes a Stroke object from the Strokes collection.

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

Syntax

'Declaration
Public Sub Remove ( _
    stroke As Stroke _
)
'Usage
Dim instance As Strokes 
Dim stroke As Stroke

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

Parameters

Remarks

Stroke objects are references to ink data. The Remove method removes ink data references rather than actual ink data. To delete the Stroke object from the actual ink data, call the Ink.DeleteStroke method.

After calling the Remove method, the Stroke objects in the collection are reordered. For example, in Microsoft Visual Basic.NET, after calling Strokes.Remove(Strokes.Item(0)), what was Strokes.Item(1) becomes Strokes.Item(0); what was strokes.Item(2) becomes strokes.Item(1); and so forth.

Examples

This C# example removes Stroke object references from the Strokes collection, theLeftToRightStokes, if the first point in the Stroke is not to the left of the last point in the Stroke. The original data in the Ink object is unaffected.

//...
foreach (Stroke testStroke in theLeftToRightStrokes)
{
    Point ptStart = testStroke.GetPoint(0);
    Point ptEnd = testStroke.GetPoint(testStroke.PacketCount - 1);
    if (ptStart.X > ptEnd.X)
        theLeftToRightStrokes.Remove(testStroke);
}

This Visual Basic .NET example removes Stroke object reference from the Strokes collection, theLeftToRightStokes, if the first point in the Stroke is not to the left of the last point in the Stroke. The original data in the Ink object is unaffected.

'...
Dim testStroke As Stroke
For Each testStroke in theLeftToRightStrokes
    Dim ptStart As Point = testStroke.GetPoint(0)
    Dim ptEnd As Point = testStroke.GetPoint(testStroke.PacketCount - 1)
    If ptStart.X > ptEnd.X Then
        TheLeftToRightStrokes.Remove(testStroke)
    End If
Next

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

Strokes Class

Strokes Members

Remove Overload

Microsoft.Ink Namespace

Strokes.RemoveAt

Stroke

Strokes