共用方式為


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

屬性值

項目的快取週框。

範例

下列範例示範 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 快取其 元素的界限,以執行點擊測試。

適用於