ContainerVisual 類別

定義

管理 Visual 物件的集合。

public ref class ContainerVisual : System::Windows::Media::Visual
public class ContainerVisual : System.Windows.Media.Visual
type ContainerVisual = class
    inherit Visual
Public Class ContainerVisual
Inherits Visual
繼承
衍生

範例

下列範例示範如何建立物件,該物件會當做兩 DrawingVisualContainerVisual 物件的父系使用。 新增至 ContainerVisual 物件的物件必須以反向迭置順序新增, (由下到上) ,以確保它們以正確的繪圖順序呈現。 為了讓視覺化樹狀結構正確列舉,此範例會提供方法與 VisualChildrenCount 屬性的 GetVisualChild 覆寫實作。

// Create a host visual derived from the FrameworkElement class.
// This class provides layout, event handling, and container support for
// the child visual objects.
public class MyContainerVisualHost : FrameworkElement
{
    private ContainerVisual _containerVisual;

    public MyContainerVisualHost(DrawingVisual border, DrawingVisual text)
    {
        // Create a ContainerVisual to hold DrawingVisual children.
        _containerVisual = new ContainerVisual();

        // Add children to ContainerVisual in reverse z-order (bottom to top).
        _containerVisual.Children.Add(border);
        _containerVisual.Children.Add(text);

        // Create parent-child relationship with host visual and ContainerVisual.
        this.AddVisualChild(_containerVisual);
    }

    // Provide a required override for the VisualChildrenCount property.
    protected override int VisualChildrenCount
    {
        get { return _containerVisual == null ? 0 : 1; }
    }

    // Provide a required override for the GetVisualChild method.
    protected override Visual GetVisualChild(int index)
    {
        if (_containerVisual == null)
        {
            throw new ArgumentOutOfRangeException();
        }

        return _containerVisual;
    }
}
' Create a host visual derived from the FrameworkElement class.
' This class provides layout, event handling, and container support for
' the child visual objects.
Public Class MyContainerVisualHost
    Inherits FrameworkElement
    Private _containerVisual As ContainerVisual

    Public Sub New(ByVal border As DrawingVisual, ByVal text As DrawingVisual)
        ' Create a ContainerVisual to hold DrawingVisual children.
        _containerVisual = New ContainerVisual()

        ' Add children to ContainerVisual in reverse z-order (bottom to top).
        _containerVisual.Children.Add(border)
        _containerVisual.Children.Add(text)

        ' Create parent-child relationship with host visual and ContainerVisual.
        Me.AddVisualChild(_containerVisual)
    End Sub

    ' Provide a required override for the VisualChildrenCount property.
    Protected Overrides ReadOnly Property VisualChildrenCount() As Integer
        Get
            Return If(_containerVisual Is Nothing, 0, 1)
        End Get
    End Property

    ' Provide a required override for the GetVisualChild method.
    Protected Overrides Function GetVisualChild(ByVal index As Integer) As Visual
        If _containerVisual Is Nothing Then
            Throw New ArgumentOutOfRangeException()
        End If

        Return _containerVisual
    End Function
End Class

備註

類別 ContainerVisual 會當做 物件集合的 Visual 容器使用。 類別 DrawingVisual 衍生自 ContainerVisual 類別,因此 DrawingVisual 類別也可以包含視覺物件的集合。

建構函式

ContainerVisual()

建立 ContainerVisual 類別的新執行個體。

屬性

BitmapEffect
已淘汰.
已淘汰.

取得或設定 BitmapEffectContainerVisual 值。

BitmapEffectInput
已淘汰.
已淘汰.

取得或設定 BitmapEffectInputContainerVisual 值。

CacheMode

取得或設定 ContainerVisual 的快取表示。

Children

取得 ContainerVisual 的子集合。

Clip

取得或設定 ContainerVisual 的裁剪區域。

ContentBounds

取得 ContainerVisual 內容的週框方塊。

DependencyObjectType

DependencyObjectType取得包裝這個實例 CLR 型別的 。

(繼承來源 DependencyObject)
DescendantBounds

取得 ContainerVisual 之所有子代的所有內容週框方塊聯集,但不包括 ContainerVisual 的內容。

Dispatcher

取得與這個 Dispatcher 關聯的 DispatcherObject

(繼承來源 DispatcherObject)
Effect

取得或設定要套用至 ContainerVisual 的點陣圖效果。

IsSealed

取得值,這個值表示此執行個體目前是否已密封 (唯讀)。

(繼承來源 DependencyObject)
Offset

取得或設定 ContainerVisual 距離其參考點的位移值。

Opacity

取得或設定 ContainerVisual 的不透明度 (根據 0=透明,1=不透明)。

OpacityMask

取得或設定筆刷,這個筆刷指定 ContainerVisual 可能的不透明遮罩。

Parent

取得 Visual 的父 ContainerVisual

Transform

取得或設定套用至 ContainerVisual 的轉換。

VisualBitmapEffect
已淘汰.
已淘汰.

取得或設定 BitmapEffectVisual 值。

(繼承來源 Visual)
VisualBitmapEffectInput
已淘汰.
已淘汰.

取得或設定 BitmapEffectInputVisual 值。

(繼承來源 Visual)
VisualBitmapScalingMode

取得或設定 BitmapScalingModeVisual

(繼承來源 Visual)
VisualCacheMode

取得或設定 Visual 的快取表示。

(繼承來源 Visual)
VisualChildrenCount

取得 ContainerVisual 的子系數目。

VisualClearTypeHint

取得或設定 ClearTypeHint,以決定 Visual 中的 ClearType 呈現方式。

(繼承來源 Visual)
VisualClip

取得或設定 Visual 的裁剪區域做為 Geometry 值。

(繼承來源 Visual)
VisualEdgeMode

取得或設定 Visual 的邊緣模式做為 EdgeMode 值。

(繼承來源 Visual)
VisualEffect

取得或設定要套用至 Visual 的點陣圖效果。

(繼承來源 Visual)
VisualOffset

取得或設定視覺物件的位移值。

(繼承來源 Visual)
VisualOpacity

取得或設定 Visual 的不透明度。

(繼承來源 Visual)
VisualOpacityMask

取得或設定 Brush 值,這個值表示 Visual 的不透明遮罩。

(繼承來源 Visual)
VisualParent

取得視覺物件的視覺化樹狀結構父物件。

(繼承來源 Visual)
VisualScrollableAreaClip

取得或設定 Visual 的可捲動裁剪區域。

(繼承來源 Visual)
VisualTextHintingMode

取得或設定 VisualTextHintingMode

(繼承來源 Visual)
VisualTextRenderingMode

取得或設定 VisualTextRenderingMode

(繼承來源 Visual)
VisualTransform

取得或設定 TransformVisual 值。

(繼承來源 Visual)
VisualXSnappingGuidelines

取得或設定 X 座標 (垂直) 導線集合。

(繼承來源 Visual)
VisualYSnappingGuidelines

取得或設定 Y 座標 (水平) 導線集合。

(繼承來源 Visual)
XSnappingGuidelines

取得或設定 ContainerVisual 的 X (水平) 導線。

YSnappingGuidelines

取得或設定 ContainerVisual 的 Y (垂直) 導線。

方法

AddVisualChild(Visual)

定義兩個視覺項目之間的父-子關係。

(繼承來源 Visual)
CheckAccess()

判斷呼叫的執行是否可以存取這個 DispatcherObject

(繼承來源 DispatcherObject)
ClearValue(DependencyProperty)

清除屬性的區域數值。 要清除的屬性是由 DependencyProperty 識別項所指定。

(繼承來源 DependencyObject)
ClearValue(DependencyPropertyKey)

清除唯讀屬性的區域數值。 要清除的屬性是由 DependencyPropertyKey 所指定。

(繼承來源 DependencyObject)
CoerceValue(DependencyProperty)

強制轉型所指定相依性屬性的值。 完成方式是叫用存在於呼叫 DependencyObject 之相依性屬性的屬性中繼資料中所指定的任何 CoerceValueCallback 函式。

(繼承來源 DependencyObject)
Equals(Object)

判斷提供的 DependencyObject 和目前的 DependencyObject 是否相等。

(繼承來源 DependencyObject)
FindCommonVisualAncestor(DependencyObject)

傳回兩個視覺物件的共同祖系。

(繼承來源 Visual)
GetHashCode()

取得這個 DependencyObject 的雜湊碼。

(繼承來源 DependencyObject)
GetLocalValueEnumerator()

建立特定的列舉值,以判斷哪些相依性屬性在此 DependencyObject 上具有本機設定的值。

(繼承來源 DependencyObject)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
GetValue(DependencyProperty)

傳回 DependencyObject 的這個執行個體上之相依性屬性的目前有效值。

(繼承來源 DependencyObject)
GetVisualChild(Int32)

傳回父代 ContainerVisual 的指定子系 Visual

HitTest(HitTestFilterCallback, HitTestResultCallback, HitTestParameters)

使用 HitTestFilterCallbackHitTestResultCallback 物件,對 ContainerVisual 起始點擊測試。

HitTest(Point)

藉由指定 Point,傳回點擊測試最上層的視覺物件。

HitTestCore(GeometryHitTestParameters)

判斷幾何值是否在視覺物件的界限中。

(繼承來源 Visual)
HitTestCore(PointHitTestParameters)

判斷點座標值是否在視覺物件的界限中。

(繼承來源 Visual)
InvalidateProperty(DependencyProperty)

重新評估指定相依性屬性的有效值。

(繼承來源 DependencyObject)
IsAncestorOf(DependencyObject)

判斷視覺物件是否為子系視覺物件的祖系。

(繼承來源 Visual)
IsDescendantOf(DependencyObject)

判斷視覺物件是否為祖系視覺物件的子系。

(繼承來源 Visual)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
OnDpiChanged(DpiScale, DpiScale)

當轉譯此 View 的 DPI 變更時呼叫。

(繼承來源 Visual)
OnPropertyChanged(DependencyPropertyChangedEventArgs)

每當這個 DependencyObject 上任何相依性屬性的有效值已更新時叫用。 已變更的特定相依性屬性會在事件資料中報告。

(繼承來源 DependencyObject)
OnVisualChildrenChanged(DependencyObject, DependencyObject)

當視覺物件的 VisualCollection 已修改時呼叫。

(繼承來源 Visual)
OnVisualParentChanged(DependencyObject)

在視覺物件的父代變更時呼叫。

(繼承來源 Visual)
PointFromScreen(Point)

將螢幕座標中的 Point 轉換為 Point,表示 Visual 的目前座標系統。

(繼承來源 Visual)
PointToScreen(Point)

將表示 Point 之目前座標系統的 Visual 轉換為螢幕座標中的 Point

(繼承來源 Visual)
ReadLocalValue(DependencyProperty)

傳回相依性屬性的區域值 (如果存在)。

(繼承來源 DependencyObject)
RemoveVisualChild(Visual)

移除兩個視覺物件之間的父-子關係。

(繼承來源 Visual)
SetCurrentValue(DependencyProperty, Object)

設定相依性屬性的值,而不需要變更其值來源。

(繼承來源 DependencyObject)
SetValue(DependencyProperty, Object)

設定相依性屬性的區域值 (由相依性屬性的識別碼所指定)。

(繼承來源 DependencyObject)
SetValue(DependencyPropertyKey, Object)

設定唯讀相依性屬性的區域數值 (由相依性屬性的 DependencyPropertyKey 識別項所指定)。

(繼承來源 DependencyObject)
ShouldSerializeProperty(DependencyProperty)

傳回值,這個值表示序列化程序是否應該序列化所提供相依性屬性的值。

(繼承來源 DependencyObject)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)
TransformToAncestor(Visual)

傳回轉換,這個轉換可用來將 Visual 的座標轉換為視覺物件的指定 Visual 祖系。

(繼承來源 Visual)
TransformToAncestor(Visual3D)

傳回轉換,這個轉換可用來將 Visual 的座標轉換為視覺物件的指定 Visual3D 祖系。

(繼承來源 Visual)
TransformToDescendant(Visual)

傳回轉換,這個轉換可用來將 Visual 的座標轉換為指定的視覺物件子系。

(繼承來源 Visual)
TransformToVisual(Visual)

傳回轉換,這個轉換可用來將 Visual 的座標轉換為指定的視覺物件。

(繼承來源 Visual)
VerifyAccess()

請強制執行可以存取這個 DispatcherObject 的呼叫執行緒。

(繼承來源 DispatcherObject)

適用於