Visual.GetVisualChild(Int32) Metoda
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Zwraca wartość określoną Visual w obiekcie nadrzędnym VisualCollection.
protected:
virtual System::Windows::Media::Visual ^ GetVisualChild(int index);
protected virtual System.Windows.Media.Visual GetVisualChild(int index);
abstract member GetVisualChild : int -> System.Windows.Media.Visual
override this.GetVisualChild : int -> System.Windows.Media.Visual
Protected Overridable Function GetVisualChild (index As Integer) As Visual
- index
- Int32
Indeks obiektu wizualizacji w obiekcie VisualCollection.
Element podrzędny VisualCollection w określonej index
wartości.
W poniższym przykładzie zdefiniowano zastąpioną implementację elementu GetVisualChild.
// Provide a required override for the GetVisualChild method.
protected override Visual GetVisualChild(int index)
{
if (index < 0 || index >= _children.Count)
{
throw new ArgumentOutOfRangeException();
}
return _children[index];
}
' Provide a required override for the GetVisualChild method.
Protected Overrides Function GetVisualChild(ByVal index As Integer) As Visual
If index < 0 OrElse index >= _children.Count Then
Throw New ArgumentOutOfRangeException()
End If
Return _children(index)
End Function
Domyślnie element Visual nie ma elementów podrzędnych. W związku z tym domyślna implementacja zawsze zgłasza błąd ArgumentOutOfRangeException.
Klasa pochodząca z Visual klasy musi zastąpić tę metodę, a także VisualChildrenCount właściwość , aby drzewo wizualne było poprawnie wyliczane.
Produkt | Wersje |
---|---|
.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, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
Opinia o produkcie .NET
.NET to projekt typu open source. Wybierz link, aby przekazać opinię: