StylusPlugIn.ElementBounds 속성

정의

요소의 캐시된 범위를 가져옵니다.

public:
 property System::Windows::Rect ElementBounds { System::Windows::Rect get(); };
public System.Windows.Rect ElementBounds { get; }
member this.ElementBounds : System.Windows.Rect
Public ReadOnly Property ElementBounds As Rect

속성 값

Rect

요소의 캐시된 범위입니다.

예제

다음 예제에서는 어떻게를 DynamicRenderer에서 상속 하는 StylusPlugIn를 사용 하 여는 ImageBrush 스트로크를 렌더링 하 합니다. 이 브러시에 지정한 이미지 파일을 부분적으로 그립니다 imageFile합니다.

if (imageBrush == null)
{
    // Create an ImageBrush.  imageFile is a string that's a path to an image file.
    image1 = new BitmapImage(new Uri(imageFile));
    imageBrush = new ImageBrush(image1);

    // Don't tile, don't stretch; align to top/left.
    imageBrush.TileMode = TileMode.None;
    imageBrush.Stretch = Stretch.None;
    imageBrush.AlignmentX = AlignmentX.Left;
    imageBrush.AlignmentY = AlignmentY.Top;

    // Map the brush to the entire bounds of the element.
    imageBrush.ViewportUnits = BrushMappingMode.Absolute;
    imageBrush.Viewport = this.ElementBounds;
    imageBrush.Freeze();
}
If imageBrush Is Nothing Then
    ' Create an ImageBrush.  imageFile is a string that's a path to an image file.
    image1 = New BitmapImage(New Uri(imageFile))
    imageBrush = New ImageBrush(image1)
    
    ' Don't tile, don't stretch; align to top/left.
    imageBrush.TileMode = TileMode.None
    imageBrush.Stretch = Stretch.None
    imageBrush.AlignmentX = AlignmentX.Left
    imageBrush.AlignmentY = AlignmentY.Top
    
    ' Map the brush to the entire bounds of the element.
    imageBrush.ViewportUnits = BrushMappingMode.Absolute
    imageBrush.Viewport = ElementBounds
    imageBrush.Freeze()
End If

설명

StylusPlugIn 캐시 하는 데 해당 요소의 경계 적중 테스트 합니다.

적용 대상