本文整理汇总了VB.NET中System.Windows.Automation.TreeWalker.GetParent方法的典型用法代码示例。如果您正苦于以下问题:VB.NET TreeWalker.GetParent方法的具体用法?VB.NET TreeWalker.GetParent怎么用?VB.NET TreeWalker.GetParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了TreeWalker.GetParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: GetTopLevelWindow
''' <summary>
''' Retrieves the top-level window that contains the specified UI Automation element.
''' </summary>
''' <param name="element">The contained element.</param>
''' <returns>The containing top-level window element.</returns>
Private Function GetTopLevelWindow(ByVal element As AutomationElement) As AutomationElement
Dim walker As TreeWalker = TreeWalker.ControlViewWalker
Dim elementParent As AutomationElement
Dim node As AutomationElement = element
If node = elementRoot Then
Return node
End If
Do
elementParent = walker.GetParent(node)
If elementParent = AutomationElement.RootElement Then
Exit Do
End If
node = elementParent
Loop While True
Return node
End Function 'GetTopLevelWindow
End Class