다음을 통해 공유


Renderer.Measure 메서드 (Stroke, DrawingAttributes)

업데이트: 2007년 11월

Renderer 개체의 Draw 메서드를 사용하여 그릴 Stroke 개체를 포함해야 하는 장치 컨텍스트의 Rectangle을 지정된 DrawingAttributes를 사용하여 계산합니다.

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

구문

‘선언
Public Function Measure ( _
    stroke As Stroke, _
    da As DrawingAttributes _
) As Rectangle
‘사용 방법
Dim instance As Renderer
Dim stroke As Stroke
Dim da As DrawingAttributes
Dim returnValue As Rectangle

returnValue = instance.Measure(stroke, _
    da)
public Rectangle Measure(
    Stroke stroke,
    DrawingAttributes da
)
public:
Rectangle Measure(
    Stroke^ stroke, 
    DrawingAttributes^ da
)
public Rectangle Measure(
    Stroke stroke,
    DrawingAttributes da
)
public function Measure(
    stroke : Stroke, 
    da : DrawingAttributes
) : Rectangle

매개 변수

반환 값

형식: System.Drawing.Rectangle
Renderer 개체의 Draw 메서드를 사용하여 그릴 Stroke 개체를 포함해야 하는 장치 컨텍스트의 Rectangle입니다. 스트로크에 X 및 Y 좌표가 포함되어 있어야 사각형을 계산할 수 있습니다. 그렇지 않으면 빈 사각형이 반환됩니다.

설명

이 메서드의 동작은 MeasureDraw 메서드에 동일한 인수를 전달할 때만 정확합니다.

경계 상자는 펜 너비의 영향을 받으므로 이 너비의 배율은 Renderer 개체의 뷰 변환에 맞게 조정됩니다. 이렇게 하려면 펜 너비에 뷰 변환 행렬식의 제곱근을 곱합니다. 경계 상자의 높이와 너비는 각 방향으로 이 거리의 절반만큼 확장되고 오른쪽과 아래쪽은 1만큼 늘어납니다.

예를 들어 펜 너비가 원래 53이고, 뷰 변환 행렬식의 제곱근이 50이고, 경계 상자가 (0, 0, 1000, 1000)이라고 가정해 봅니다. 경계 상자에 대한 펜 너비 조정은 각 방향으로 (53*50)/2로 계산되고 오른쪽과 아래쪽은 1만큼 늘어납니다. 따라서 경계 상자가 (-1325, -1325, 2326, 2326)으로 렌더링됩니다.

예제

이 C# 예제에서는 펜 너비가 두 배로 늘어날 때 Stroke 개체인 theStroke에 대한 경계 사각형을 가져옵니다. Renderer 개체의 출처는 InkOverlay 개체인 theInkOverlay입니다.

DrawingAttributes drawingAtt = theStroke.DrawingAttributes.Clone();
drawingAtt.Width = drawingAtt.Width * 2;
Rectangle bounds = theInkOverlay.Renderer.Measure(theStroke, drawingAtt);

이 Microsoft® Visual Basic® .NET 예제에서는 펜 너비가 두 배로 늘어날 때 Stroke 개체인 theStroke에 대한 경계 사각형을 가져옵니다. Renderer 개체의 출처는 InkOverlay 개체인 theInkOverlay입니다.

Dim drawingAtt As DrawingAttributes = theStroke.DrawingAttributes.Clone();
drawingAtt.Width = drawingAtt.Width * 2;
Dim bounds As Rectangle = theInkOverlay.Renderer.Measure(theStroke, drawingAtt);

플랫폼

Windows Vista

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

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

Renderer 클래스

Renderer 멤버

Measure 오버로드

Microsoft.Ink 네임스페이스

Renderer.Draw

Stroke.GetBoundingBox

Strokes.GetBoundingBox

DrawingAttributes