AutomationElementCollection.Item[Int32] 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取位于指定索引处的 AutomationElement。
public:
property System::Windows::Automation::AutomationElement ^ default[int] { System::Windows::Automation::AutomationElement ^ get(int index); };
public System.Windows.Automation.AutomationElement this[int index] { get; }
member this.Item(int) : System.Windows.Automation.AutomationElement
Default Public ReadOnly Property Item(index As Integer) As AutomationElement
参数
- index
- Int32
集合中元素的从零开始的索引。
属性值
指定索引处的 AutomationElement。
例外
为 index
指定了一个负整数,或 index
大于或等于 Count。
示例
In the following example, the first element is retrieved from an AutomationElementCollection.
// desktopChildren is a collection of AutomationElement objects.
AutomationElement firstWindow;
try
{
firstWindow = desktopChildren[0];
}
catch (IndexOutOfRangeException)
{
Console.WriteLine("No AutomationElement at that index.");
}
' desktopChildren is a collection of AutomationElement objects.
Dim firstWindow As AutomationElement
Try
firstWindow = desktopChildren(0)
Catch ex As IndexOutOfRangeException
Console.WriteLine("No AutomationElement at that index.")
End Try