SetPoints Method
SetPoints Method |
Sets the points of the IInkStrokeDisp using an array of X, Y values.
Declaration
[C++]
HRESULT SetPoints(
[in] VARIANT points,
[in, optional, defaultvalue(ISC_FirstElement)] long index,
[in, optional, defaultvalue(ISC_AllElements)] long count,
[out, retval] long* NumberOfPacketsSet
);
[Microsoft® Visual Basic® 6.0]
Public Function SetPoints( _
points, _
[index As Long], _
[count As Long = -1] _
) As Long
Parameters
index
[in, optional] The zero-based index of the first point in the stroke to be modified. The default value ISC_FirstElement, defined in the ItemSelectionConstants enumeration type, specifies that the first point in the stroke is modified.
count
[in, optional] The count of points in the stroke to be modified. The default value ISC_AllElements, defined in the ItemSelectionConstants enumeration type, specifies that all points in the stroke are modified.
points
[in] The array of new points to replace the points in the stroke beginning at index. This is a Variant containing an array of Long with the points represented by alternating values of the form x0, y0, x1, y1, x2, y2, etc.
For more information about the VARIANT structure, see Using the Automation Library.
Return Value
Returns the actual number of points set.
HRESULT value | Description |
---|---|
S_OK | Success. |
E_POINTER | A parameter contained an invalid pointer. |
E_INVALIDARG | Invalid index (out of range), or VARIANT parameter was not in the correct format. |
E_INK_EXCEPTION | An exception occurred inside the method. |
Remarks
This method does not change the number of points in the stroke. To change the number of points in the stroke, a new stroke must be created, or the stroke must be split.
This method does not provide for truncating the stroke. If the points array contains fewer points than the stroke, the remainder of the points in the stroke are not be modified.
This method does not provide for extending the stroke. If the points array contains more points than the stroke, the extra points are not used. If the count exceeds the number of points in the array, only the number of points in the array are modified.
Due to an issue in Visual Basic 6.0, calling form.Refresh after calling SetPoints do not draw the new stroke. The parent form receives an invalidation request but does not necessarily invalidate child control windows on the form. Therefore, the stroke is not repainted in its modified form. To explicitly invalidate the control, call the Win32 InvalidateRect API.
Example
[Visual Basic 6.0]
This Visual Basic 6.0 example sets the points of the IInkStrokeDisp theStroke to the contents of the array of points theNewPoints.
Dim thePointsSet As Long
thePointsSet = theStroke.SetPoints(theNewPoints)