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 형식의 값입니다.

예외

descendantnull입니다.

시각적 개체는 시각적 개체의 상위 항목이 descendant 아닙니다.

시각적 개체는 관련이 없습니다.

예제

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

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

다음 코드 예제에서는 해당 자식TransformToDescendant에 상대적인 오프 StackPanel 셋을 검색 하는 메서드를 사용 TextBlock 하는 방법을 보여 있습니다. 오프셋 값은 반환 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입니다. 부모 개체가 자식 개체를 기준으로 음수 오프셋이므로 오프셋 값은 음수 값입니다.

적용 대상