Share via


Stroke.SetPoints Method (Int32, array<Point[])

Sets a range of Point structures that starts at the specified index in a Stroke object.

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

Syntax

'Declaration
Public Function SetPoints ( _
    index As Integer, _
    points As Point() _
) As Integer
'Usage
Dim instance As Stroke 
Dim index As Integer 
Dim points As Point()
Dim returnValue As Integer 

returnValue = instance.SetPoints(index, _
    points)
public int SetPoints(
    int index,
    Point[] points
)
public:
int SetPoints(
    int index, 
    array<Point>^ points
)
public function SetPoints(
    index : int, 
    points : Point[]
) : int

Parameters

  • index
    Type: System.Int32

    The zero-based index of the first point in the Stroke object to be modified.

Return Value

Type: System.Int32
Returns the actual number of points set.

Remarks

This method does not change the number of points in the Stroke object. To change the number of points in the Stroke object, a new Stroke object must be created, or the Stroke object must be split.

The length of the points array determines the count of points to be modified in the Stroke object.

This method does not provide for truncating the Stroke object. If the points array contains fewer points than the Stroke object, the remainder of the points in the Stroke object are not modified.

This method does not provide for extending the Stroke object. If the points array contains more points than the Stroke object, the extra points are not used.

Examples

In this example, the second half of each selected Stroke object of an InkOverlay is changed into a horizontal stroke by obtaining the points for the second half of the Stroke, and then standardizing each Y coordinate. After the values are modified, the SetPoints method is used to update the Stroke object.

For Each S As Stroke In mInkOverlay.Selection
    Dim halfwayPt As Integer = S.PacketCount / 2
    ' get the points 
    Dim pts() As Point = S.GetPoints(halfwayPt, S.PacketCount - halfwayPt)
    ' set each Y coordinate to the first Y coordinate 
    For k As Integer = 0 To pts.Length - 1
        pts(k).Y = pts(0).Y
    Next 
    ' update the points
    S.SetPoints(halfwayPt, pts)
Next
foreach (Stroke S in mInkOverlay.Selection)
{
    int halfwayPt = S.PacketCount / 2;
    // get the points
    Point[] pts = S.GetPoints(halfwayPt, S.PacketCount - halfwayPt);
    // set each Y coordinate to the first Y coordinate 
    for (int k = 0; k < pts.Length; k++)
    {
        pts[k].Y = pts[0].Y;
    }
    // update the points
    S.SetPoints(halfwayPt, pts);
}

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

Stroke Class

Stroke Members

SetPoints Overload

Microsoft.Ink Namespace

SetPoints

Stroke.SetPoint