Visual.TransformToDescendant(Visual) 메서드

정의

좌표를 Visual에서 지정된 시각적 개체 하위 항목으로 변환하는 데 사용할 수 있는 변환을 반환합니다.

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

매개 변수

descendant
Visual

좌표가 변환되는 Visual입니다.

반환

GeneralTransform

GeneralTransform 형식의 값입니다.

예외

descendant이(가) null인 경우

시각적 개체가 descendant 시각적 개체의 상위 항목이 아닌 경우

시각적 개체가 관련되지 않은 경우

예제

다음 태그 예제에서는 개체 내에 StackPanel 포함된 항목을 보여 TextBlock 줍니다.

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

다음 코드 예제에서는 해당 자식TextBlock에 상대적인 StackPanel 오프셋을 검색 하는 메서드를 사용 TransformToDescendant 하는 방법을 보여 있습니다. 오프셋 값은 반환 GeneralTransform 된 값 내에 포함됩니다.

// 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))

오프셋은 모든 개체의 Margin 값을 고려합니다. 이 경우 X -4이고 Y -4입니다. 부모 개체가 자식 개체를 기준으로 음수 오프셋이므로 오프셋 값은 음수 값입니다.

적용 대상