ContainerVisual.ContentBounds 屬性

定義

取得 ContainerVisual 內容的週框方塊。

public:
 property System::Windows::Rect ContentBounds { System::Windows::Rect get(); };
public System.Windows.Rect ContentBounds { get; }
member this.ContentBounds : System.Windows.Rect
Public ReadOnly Property ContentBounds As Rect

屬性值

Rect

指定週框方塊的 Rect

範例

下列範例示範如何擷取 物件的周框 ContainerVisual

// Return the bounding rectangle for the ContainerVisual.
Rect rectBounds = containerVisual.ContentBounds;

// Expand the rectangle to include the bounding rectangle
// of the all of the ContainerVisual's descendants.
rectBounds.Union(containerVisual.DescendantBounds);
' Return the bounding rectangle for the ContainerVisual.
Dim rectBounds As Rect = containerVisual.ContentBounds

' Expand the rectangle to include the bounding rectangle
' of the all of the ContainerVisual's descendants.
rectBounds.Union(containerVisual.DescendantBounds)

備註

DescendantBounds使用 屬性可傳回物件所有子系之所有內容周框方塊的 ContainerVisual 聯集,但不會傳回物件本身。

適用於