Stroke.GetPoint Method
Returns the Point structure at the specified index in a Stroke object.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)
Syntax
'Declaration
Public Function GetPoint ( _
index As Integer _
) As Point
'Usage
Dim instance As Stroke
Dim index As Integer
Dim returnValue As Point
returnValue = instance.GetPoint(index)
public Point GetPoint (
int index
)
public:
Point GetPoint (
int index
)
public Point GetPoint (
int index
)
public function GetPoint (
index : int
) : Point
Not applicable.
Parameters
- index
The zero-based index of the Point structure to return.
Return Value
Returns the Point structure at the specified index in the Stroke object.
Remarks
This method returns a floating point index value that describes the point. A floating point index is a float value that represents a location somewhere between two points in the Stroke object. 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.
Example
This C# example returns an interpolated point from a Stroke object, theStroke
, given as a floating point (Float) index value.
private Point LocatePoint(Stroke theStroke, float theFIndex)
{
Point ptResult = theStroke.GetPoint((int)theFIndex);
float theFraction = theFIndex - (int)theFIndex;
if (theFraction > 0.0f)
{
Point ptDelta = theStroke.GetPoint((int)theFIndex + 1);
ptResult.X += (int)((ptDelta.X - ptResult.X) * theFraction);
ptResult.Y += (int)((ptDelta.Y - ptResult.Y) * theFraction);
}
return ptResult;
}
This Microsoft® Visual Basic® .NET example returns an interpolated point from a Stroke object, theStroke
, given as a floating point (Float) index value.
Private Function LocatePoint( _
ByVal theStroke As Stroke, ByVal theFIndex As Single) As Point
Dim theIndex As Integer = Math.Floor(theFIndex)
Dim theFraction As Single = theFIndex - theIndex
Dim ptResult As Point = theStroke.GetPoint(theIndex)
If theFraction > 0.0 Then
Dim ptDelta As Point = theStroke.GetPoint(theIndex + 1)
ptResult.X += CInt((ptDelta.X - ptResult.X) * theFraction)
ptResult.Y += CInt((ptDelta.Y - ptResult.Y) * theFraction)
End If
Return ptResult
End Function
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
Microsoft.Ink.Stroke.GetPoints