StylusPlugIn.ElementBounds 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取元素的缓存边界。
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
属性值
元素的缓存边界。
示例
下面的示例演示继承自 StylusPlugInImageBrush 的 如何使用 DynamicRenderer来呈现笔划。 此画笔部分绘制指定的 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 其元素的边界以执行命中测试。