StylusPlugIn.ElementBounds Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the cached bounds of the element.
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
Property Value
The cached bounds of the element.
Examples
The following example demonstrates how a DynamicRenderer, which inherits from StylusPlugIn, uses an ImageBrush to render a stroke. This brush partially draws the image file specified by 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
Remarks
The StylusPlugIn caches the bounds of its element to perform hit testing.
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET