다음을 통해 공유


Renderer.PixelToInkSpace 메서드 (Graphics, array<Point[]%)

업데이트: 2007년 11월

변환 시 Graphics 개체를 사용하여 픽셀 공간 좌표의 위치 배열을 잉크 공간 좌표의 위치 배열로 변환합니다.

네임스페이스:  Microsoft.Ink
어셈블리:  Microsoft.Ink(Microsoft.Ink.dll)

구문

‘선언
Public Sub PixelToInkSpace ( _
    g As Graphics, _
    ByRef pts As Point() _
)
‘사용 방법
Dim instance As Renderer
Dim g As Graphics
Dim pts As Point()

instance.PixelToInkSpace(g, pts)
public void PixelToInkSpace(
    Graphics g,
    ref Point[] pts
)
public:
void PixelToInkSpace(
    Graphics^ g, 
    array<Point>^% pts
)
public void PixelToInkSpace(
    Graphics g,
    /** @ref */Point[] pts
)
public function PixelToInkSpace(
    g : Graphics, 
    pts : Point[]
)

매개 변수

  • pts
    형식: array<System.Drawing.Point[]%
    잉크 공간 위치로 변환할 점의 배열입니다.

설명

PixelToInkSpace 메서드는 픽셀을 잉크 공간으로 변환합니다. 잉크 공간에서 HIMETRIC 단위 하나는 0.01mm입니다. 그런 다음 뷰 변환의 역을 적용하고 개체 변환을 적용합니다.

예제

이 예제에서는 경계 선택 내에 해당 점의 50% 이상이 들어 있는 InkOverlayStroke 개체가 빨간색으로 변경됩니다. 경계 선택 점은 잉크 컨트롤의 중심을 기준으로 45도 회전하는 사각형을 설명합니다. 그런 다음 선택 지점을 사용하여 Stroke 개체를 만드는 방식으로 경계 선택을 표시합니다.

Const RadiusPixel As Integer = 120
' get the control. InkOverlay.AttachedControl must be set
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)
' create the boundary points. These points describe a rectangle
' that is rotated around the center 45 degrees (a diamond)
Dim boundaryPts() As Point = _
        { _
            New Point(centerPt.X, centerPt.Y - (RadiusPixel / 2)), _
            New Point(centerPt.X + (RadiusPixel / 2), centerPt.Y), _
            New Point(centerPt.X, centerPt.Y + (RadiusPixel / 2)), _
            New Point(centerPt.X - (RadiusPixel / 2), centerPt.Y), _
            New Point(centerPt.X, centerPt.Y - (RadiusPixel / 2)) _
        }

Using g As Graphics = inkControl.CreateGraphics()
    ' convert boundary points to ink space coordinates
    mInkOverlay.Renderer.PixelToInkSpace(g, boundaryPts)
End Using
' show the tilted rectangle (diamond) by creating a stroke
mInkOverlay.Ink.CreateStroke(boundaryPts)
' Find strokes that are at least 50% inside the boundary points
Dim hitStrokes As Strokes = mInkOverlay.Ink.HitTest(boundaryPts, 50.0F)
' change the strokes that fall inside the boundary points to red
hitStrokes.ModifyDrawingAttributes(New DrawingAttributes(Color.Red))
' invalidate the ink control
inkControl.Invalidate()
const int RadiusPixel = 120;
// get the control. InkOverlay.AttachedControl must be set
Control inkControl = mInkOverlay.AttachedControl;
// get the center of the ink control
Point centerPt = new Point(inkControl.Width / 2, inkControl.Height / 2);
// create the boundary points. These points describe a rectangle
// that is rotated around the center 45 degrees (a diamond)
Point[] boundaryPts = new Point[5] 
    {
        new Point(centerPt.X, centerPt.Y - (RadiusPixel / 2)),
        new Point(centerPt.X + (RadiusPixel / 2), centerPt.Y),
        new Point(centerPt.X, centerPt.Y + (RadiusPixel / 2)),
        new Point(centerPt.X - (RadiusPixel / 2), centerPt.Y),
        new Point(centerPt.X, centerPt.Y - (RadiusPixel / 2))
    };

using (Graphics g = inkControl.CreateGraphics())
{
    // convert boundary points to ink space coordinates
    mInkOverlay.Renderer.PixelToInkSpace(g, ref boundaryPts);
}

// show the tilted rectangle (diamond) by creating a stroke
mInkOverlay.Ink.CreateStroke(boundaryPts);
// Find strokes that are at least 50% inside the boundary points
Strokes hitStrokes = mInkOverlay.Ink.HitTest(boundaryPts, 50.0f);
// change the strokes that fall inside the boundary points to red
hitStrokes.ModifyDrawingAttributes(new DrawingAttributes(Color.Red));
// invalidate the ink control
inkControl.Invalidate();

플랫폼

Windows Vista

.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

Renderer 클래스

Renderer 멤버

PixelToInkSpace 오버로드

Microsoft.Ink 네임스페이스

Renderer.InkSpaceToPixel