업데이트: 2007년 11월
잉크 공간 좌표에 지정된 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가 들어 있으면 이 결과의 값을 예측할 수 없습니다. 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에서 지원