Share via


Stroke.Split Method

Splits the Stroke object at the specified location on the Stroke object and returns the new Stroke object.

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

Syntax

'Declaration
Public Function Split ( _
    findex As Single _
) As Stroke
'Usage
Dim instance As Stroke
Dim findex As Single
Dim returnValue As Stroke

returnValue = instance.Split(findex)
public Stroke Split (
    float findex
)
public:
Stroke^ Split (
    float findex
)
public Stroke Split (
    float findex
)
public function Split (
    findex : float
) : Stroke
Not applicable.

Parameters

  • findex
    The floating point index value that represents where to split the Stroke object.

Return Value

The new Stroke object that is created as a result of calling this method.

Remarks

A floating point index is a float value that represents a location somewhere between two points in the stroke. As examples, if 0.0 is the first point in the stroke and 1.0 is the second point in the stroke, 0.5 is halfway between the first and second points. Similarly, a floating point index value of 37.25 represents a location that is 25 percent along the line between points 37 and 38 of the stroke.

When a Stroke is split, one portion of the stroke retains the Id property of the original Stroke object. The other portion of the Stroke becomes a new Stroke object with an Id property that is one greater than the highest existing Id property. If the original Stroke was in a Strokes collection (other than the Ink.Strokes), only the beginning portion remains in that collection.

Example

This C# example splits a Stroke object, theStroke, in half and renders the second half green.

float halfIndex = 0.5f * theStroke.GetPoints().Length;
Stroke endStroke = theStroke.Split(halfIndex);
endStroke.DrawingAttributes.Color = Color.Green;

This Microsoft® Visual Basic® .NET example splits a Stroke object, theStroke, in half and renders the second half green.

Dim halfIndex As Single = theStroke.GetPoints().Length / 2
Dim endStroke As Stroke = theStroke.Split(halfIndex)
endStroke.DrawingAttributes.Color = Color.Green

This C# example splits the first Stroke object in a Strokes collection, theStrokes, in half, and then adds the newly created Stroke object back into theStrokes.

float halfIndex = 0.5f * theStrokes[0].GetPoints().Length;
Stroke endStroke = theStrokes[0].Split(halfIndex);
theStrokes.Add(endStroke);

This Visual Basic .NET example splits the first Stroke object in a Strokes collection, theStrokes, in half, and then adds the newly created Stroke object back into theStrokes.

Dim halfIndex As Single = theStrokes(0).GetPoints().Length / 2
Dim endStroke As Stroke = theStrokes(0).Split(halfIndex)
theStrokes.Add(endStroke)

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

Stroke Class
Stroke Members
Microsoft.Ink Namespace