Ink.NearestPoint メソッド (Point)
インク空間座標内で指定された Point に最も近い Ink オブジェクト内の Stroke オブジェクトを返します。
名前空間 : Microsoft.Ink
アセンブリ : Microsoft.Ink (Microsoft.Ink.dll 内)
構文
'宣言
Public Function NearestPoint ( _
point As Point _
) As Stroke
'使用
Dim instance As Ink
Dim point As Point
Dim returnValue As Stroke
returnValue = instance.NearestPoint(point)
public Stroke NearestPoint(
Point point
)
public:
Stroke^ NearestPoint(
Point point
)
public Stroke NearestPoint(
Point point
)
public function NearestPoint(
point : Point
) : Stroke
パラメータ
- point
型 : System.Drawing.Point
インク空間座標内で指定された Ink オブジェクト内にある指定されたポイント。
戻り値
型 : Microsoft.Ink.Stroke
Ink オブジェクト内の指定された point に最も近い Point を含む Stroke。既知の Point からの距離が同じである Point が 1 つ以上のストロークに含まれている場合、この結果値は任意になります。Ink オブジェクトに Stroke オブジェクトが含まれていない場合、戻り値は nullnull 参照 (Visual Basic では Nothing) (Visual Basic では Nothing) になります。
例
この例では、インク コントロールの中心に最も近い Stroke オブジェクトの色が赤に変更されます。
Dim inkControl As Control = mInkOverlay.AttachedControl
' get the center of the ink control
Dim centerPt As Point = New Point(inkControl.Width / 2, inkControl.Height / 2)
Using g As Graphics = inkControl.CreateGraphics()
' convert center point to ink space coordinates
mInkOverlay.Renderer.PixelToInkSpace(g, centerPt)
End Using
' get the nearest stroke
Dim nStroke As Stroke = mInkOverlay.Ink.NearestPoint(centerPt)
' nStroke will be null if there aren't any strokes
If Not IsNothing(nStroke) Then
' change the color of the nearest stroke to red
nStroke.DrawingAttributes.Color = Color.Red
inkControl.Invalidate()
End If
Control inkControl = mInkOverlay.AttachedControl;
// get the center of the ink control
Point centerPt = new Point(inkControl.Width / 2, inkControl.Height / 2);
using (Graphics g = inkControl.CreateGraphics())
{
// convert center point to ink space coordinates
mInkOverlay.Renderer.PixelToInkSpace(g, ref centerPt);
}
// get the nearest stroke
Stroke nStroke = mInkOverlay.Ink.NearestPoint(centerPt);
// nStroke will be null if there aren't any strokes
if (nStroke != null)
{
// change the color of the nearest stroke to red
nStroke.DrawingAttributes.Color = Color.Red;
inkControl.Invalidate();
}
プラットフォーム
Windows Vista
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 3.0