Stroke.NearestPoint Method (Point, Single)
Returns the location on the Stroke object nearest to a specified Point and the distance between the point and the Stroke object.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)
Syntax
'Declaration
Public Function NearestPoint ( _
pt As Point, _
<OutAttribute> ByRef distance As Single _
) As Single
'Usage
Dim instance As Stroke
Dim pt As Point
Dim distance As Single
Dim returnValue As Single
returnValue = instance.NearestPoint(pt, distance)
public float NearestPoint (
Point pt,
out float distance
)
public:
float NearestPoint (
Point pt,
[OutAttribute] float% distance
)
public float NearestPoint (
Point pt,
/** @attribute OutAttribute() */ /** @ref */ float distance
)
Not applicable.
Parameters
- pt
The specified point, in ink space coordinates.
- distance
The distance from the point to the Stroke object, as a floating point index.
Return Value
Returns the location on the Stroke object nearest to a specified Point.
Remarks
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 the nearest location on the Stroke object, theStroke
, to the Point, theInkSpacePoint
. This overload also gets the distance between those two points, theDistance
.
float theDistance;
float theFIndex = theStroke.NearestPoint(theInkSpacePoint, out theDistance);
This Microsoft® Visual Basic® .NET example returns the nearest location on the Stroke object, theStroke
, to the Point, theInkSpacePoint
. This overload also gets the distance between those two points, theDistance
.
Dim theDistance As Single
Dim theFIndex As Single = theStroke.NearestPoint(theInkSpacePoint, theDistance)
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.Ink.NearestPoint
Microsoft.Ink.Ink.HitTest
Stroke.GetRectangleIntersections