本文整理匯總了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