Compartir a través de


Stroke.GetPoint Method

Stroke.GetPoint Method

Returns the Point Leave Site structure at the specified index in a Stroke object.

Definition

Visual Basic .NET Public Function GetPoint( _
ByVal index As Integer _
) As Point
C# public Point GetPoint(
int index
);
Managed C++ public: Point* GetPoint(
int *index
);

Parameters

index System.Int32. The zero-based index of the Point Leave Site structure to return.

Return Value

System.Drawing.Point. Returns the Point Leave Site 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.

Examples

[C#]

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

[VB.NET]

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
                

See Also