LayoutInformation 类

定义

定义提供有关元素布局状态的其他信息的方法。

public ref class LayoutInformation abstract sealed
public static class LayoutInformation
type LayoutInformation = class
Public Class LayoutInformation
继承
LayoutInformation

示例

以下示例演示如何使用GetLayoutSlot该方法将 a FrameworkElement 边界框转换为 。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

方法

名称 说明
GetLayoutClip(FrameworkElement)

返回一个 Geometry 表示元素的可见区域。

GetLayoutExceptionElement(Dispatcher)

返回布局引擎在未经处理的异常时正在处理的一 UIElement 个。

GetLayoutSlot(FrameworkElement)

返回一个 Rect 表示为子元素保留的布局分区。

适用于