AutomationElementMode 列舉

定義

包含值,這些值會指定傳回使用者介面自動化項目時所使用的參考型別。Contains values that specify the type of reference to use when returning UI Automation elements. 這些值用於 AutomationElementMode 屬性。These values are used in the AutomationElementMode property.

public enum class AutomationElementMode
public enum AutomationElementMode
type AutomationElementMode = 
Public Enum AutomationElementMode
繼承
AutomationElementMode

欄位

Full 1

指定傳回的元素具有基礎 UI 的完整參考。Specifies that returned elements have a full reference to the underlying UI.

None 0

指定傳回的元素沒有基礎 UI 的參考,而且只包含快取的資訊。Specifies that returned elements have no reference to the underlying UI and contain only cached information. 本模式可能的用途,例如:不必取得項目本身的參考,即可擷取清單方塊內項目的名稱。This mode might be used, for example, to retrieve the names of items in a list box without obtaining references to the items themselves.

範例

下列範例顯示如何在上設定模式 CacheRequestThe following example shows how to set the mode on a CacheRequest.

// Set up the request.
CacheRequest cacheRequest = new CacheRequest();

// Do not get a full reference to the cached objects, only to their cached properties and patterns.
cacheRequest.AutomationElementMode = AutomationElementMode.None;
' Set up the request.
Dim cacheRequest As New CacheRequest()

' Do not get a full reference to the cached objects, only to their cached properties and patterns.
cacheRequest.AutomationElementMode = AutomationElementMode.None

備註

Full 是預設值,會指定傳回的元素包含基礎使用者介面的完整參考, (UI) 。Full is the default, and specifies that returned elements contain a full reference to the underlying user interface (UI). None 指定傳回的元素沒有基礎 UI 的參考,而且只包含快取的資訊。None specifies that the returned elements have no reference to the underlying UI, and contain only cached information.

專案的某些作業(例如 GetCurrentPropertyValueSetFocus )需要完整參考; 嘗試在沒有任何結果的專案上執行這些作業 InvalidOperationExceptionCertain operations on elements, such as GetCurrentPropertyValue or SetFocus, require a full reference; attempting to perform these on an element that has none results in an InvalidOperationException.

當只需要屬性時,使用 None 可能更有效率,因為它可避免與設定完整參考相關的額外負荷。Using None can be more efficient when only properties are needed, as it avoids the overhead involved in setting up full references.

適用於

另請參閱