LayoutInformation 类

定义

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

C#
public static class LayoutInformation
继承
LayoutInformation

示例

下面的示例演示如何使用 GetLayoutSlot 该方法将边界 FrameworkElement 框转换为 a GeometryDrawing

C#
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();
}

方法

GetLayoutClip(FrameworkElement)

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

GetLayoutExceptionElement(Dispatcher)

返回一个 UIElement,布局引擎将在发生未经处理的异常时对其进行处理。

GetLayoutSlot(FrameworkElement)

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

适用于

产品 版本
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7