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

Parameters

  • stroke
    The Stroke object to remove.

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.

Example

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

Strokes Class
Strokes Members
Microsoft.Ink Namespace
Strokes.RemoveAt
Stroke