Visual.TransformToDescendant(Visual) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
좌표를 지정된 시각적 개체 하위 항목으로 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
매개 변수
반품
GeneralTransform 형식의 값입니다.
예외
descendant은 null입니다.
시각적 개체는 시각적 개체의 상위 항목이 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입니다. 부모 개체가 자식 개체를 기준으로 음수 오프셋이므로 오프셋 값은 음수 값입니다.