Partager via


LayoutInformation.GetLayoutSlot(FrameworkElement) Méthode

Définition

Retourne un Rect qui représente la partition de disposition réservée pour un élément enfant.

public:
 static System::Windows::Rect GetLayoutSlot(System::Windows::FrameworkElement ^ element);
public static System.Windows.Rect GetLayoutSlot (System.Windows.FrameworkElement element);
static member GetLayoutSlot : System.Windows.FrameworkElement -> System.Windows.Rect
Public Shared Function GetLayoutSlot (element As FrameworkElement) As Rect

Paramètres

element
FrameworkElement

FrameworkElement dont l'emplacement de disposition est souhaité.

Retours

Un Rect qui représente l'emplacement de disposition de l'élément.

Exemples

L’exemple suivant montre comment utiliser la GetLayoutSlot méthode pour traduire le cadre englobant d’un FrameworkElement en .GeometryDrawing

private void getLayoutSlot1(object sender, System.Windows.RoutedEventArgs e)
{
    RectangleGeometry myRectangleGeometry = new RectangleGeometry();
    myRectangleGeometry.Rect = LayoutInformation.GetLayoutSlot(txt1);
    Path myPath = new Path();
    myPath.Data = myRectangleGeometry;
    myPath.Stroke = Brushes.LightGoldenrodYellow;
    myPath.StrokeThickness = 5;
    Grid.SetColumn(myPath, 0);
    Grid.SetRow(myPath, 0);
    myGrid.Children.Add(myPath);
    txt2.Text = "LayoutSlot is equal to " + LayoutInformation.GetLayoutSlot(txt1).ToString();
}
Private Sub getLayoutSlot1(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim myRectangleGeometry As New RectangleGeometry
    myRectangleGeometry.Rect = LayoutInformation.GetLayoutSlot(txt1)
    Dim myPath As New Path
    myPath.Data = myRectangleGeometry
    myPath.Stroke = Brushes.LightGoldenrodYellow
    myPath.StrokeThickness = 5
    Grid.SetColumn(myPath, 0)
    Grid.SetRow(myPath, 0)
    myGrid.Children.Add(myPath)
    txt2.Text = "LayoutSlot is equal to " + LayoutInformation.GetLayoutSlot(txt1).ToString()
End Sub

S’applique à