Visual.TransformToDescendant(Visual) Yöntem

Tanım

koordinatları öğesinden Visual belirtilen görsel nesne alt öğesine dönüştürmek için kullanılabilecek bir dönüştürme döndürür.

public:
 System::Windows::Media::GeneralTransform ^ TransformToDescendant(System::Windows::Media::Visual ^ descendant);
public System.Windows.Media.GeneralTransform TransformToDescendant (System.Windows.Media.Visual descendant);
member this.TransformToDescendant : System.Windows.Media.Visual -> System.Windows.Media.GeneralTransform
Public Function TransformToDescendant (descendant As Visual) As GeneralTransform

Parametreler

descendant
Visual

Visual Koordinatların dönüştürüldüğü yer.

Döndürülenler

GeneralTransform

türünde GeneralTransformbir değer.

Özel durumlar

descendant, null değeridir.

Görsel, görselin descendant bir atası değildir.

Görsel nesneler ilişkili değildir.

Örnekler

Aşağıdaki işaretleme örneği, bir TextBlock nesnenin içinde yer alan bir StackPanel öğesini gösterir.

<StackPanel Name="myStackPanel" Margin="8">
  <TextBlock Name="myTextBlock" Margin="4" Text="Hello, world" />
</StackPanel>

Aşağıdaki kod örneği, öğesinin TransformToDescendant alt TextBlocköğesine göre uzaklığını StackPanel almak için yönteminin nasıl kullanılacağını gösterir. Uzaklık değerleri döndürülen GeneralTransform değerin içinde yer alır.

// Return the general transform for the specified visual object.
GeneralTransform generalTransform1 = myStackPanel.TransformToDescendant(myTextBlock);

// Retrieve the point value relative to the child.
Point currentPoint = generalTransform1.Transform(new Point(0, 0));
' Return the general transform for the specified visual object.
Dim generalTransform1 As GeneralTransform = myStackPanel.TransformToDescendant(myTextBlock)

' Retrieve the point value relative to the child.
Dim currentPoint As Point = generalTransform1.Transform(New Point(0, 0))

Uzaklık, tüm nesnelerin değerlerini dikkate Margin alır. Bu durumda, X -4 ve Y -4 olur. Üst nesne alt nesnesine göre negatif uzaklık olduğundan uzaklık değerleri negatif değerlerdir.

Şunlara uygulanır