StylusPlugIn.ElementBounds Propriedade

Definição

Obtém os limites de cache do elemento.

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

Valor da propriedade

Rect

Os limites armazenados em cache do elemento.

Exemplos

O exemplo a seguir demonstra como um DynamicRenderer, que herda de StylusPlugIn, usa um ImageBrush para renderizar um traço. Esse pincel desenha parcialmente o arquivo de imagem especificado por 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

Comentários

Os StylusPlugIn limites de seu elemento são armazenados em cache para executar testes de ocorrência.

Aplica-se a