StrokeCollection.GetBounds 메서드

정의

컬렉션에 있는 스트로크의 범위를 반환합니다.

public:
 System::Windows::Rect GetBounds();
public System.Windows.Rect GetBounds ();
member this.GetBounds : unit -> System.Windows.Rect
Public Function GetBounds () As Rect

반환

Rect

Rect에 있는 스트로크의 범위를 포함하는 StrokeCollection입니다.

예제

다음 예제에서는의 범위를 가져옵니다 하는 방법에 설명 합니다 StrokeCollection 컨트롤에 그리는 합니다. 이 예제에서는 있다고 가정를 InkCanvas 호출 inkCanvas1합니다.

public void GetBounds()
{
    Rect bounds = inkCanvas1.Strokes.GetBounds();

    Rectangle boundsShape = new Rectangle();
    boundsShape.Width = bounds.Width;
    boundsShape.Height = bounds.Height;
    boundsShape.Stroke = Brushes.Red;

    InkCanvas.SetTop(boundsShape, bounds.Top);
    InkCanvas.SetLeft(boundsShape, bounds.Left);

    inkCanvas1.Children.Add(boundsShape);
}
Public Sub GetBounds()
    Dim bounds As Rect = inkCanvas1.Strokes.GetBounds()

    Dim boundsShape As Rectangle = New Rectangle()
    boundsShape.Width = bounds.Width
    boundsShape.Height = bounds.Height
    boundsShape.Stroke = Brushes.Red

    InkCanvas.SetTop(boundsShape, bounds.Top)
    InkCanvas.SetLeft(boundsShape, bounds.Left)

    inkCanvas1.Children.Add(boundsShape)
End Sub

설명

합니다 GetBounds 메서드가 반환 되는 Rect 는 렌더링 된 모양을 사용 하는 Stroke합니다. 예를 들어 경우 Stroke 10 표시 독립 픽셀 (DIP)를 합니다 Rect 의 전체 너비를 포함 합니다 Stroke합니다.

적용 대상