ToggleState 枚举


包含用于指定 UI 自动化元素的 ToggleState 的值。Contains values that specify the ToggleState of a UI Automation element.

public enum class ToggleState
public enum ToggleState
type ToggleState = 
Public Enum ToggleState


Indeterminate 2

UI 自动化元素处于不确定状态。The UI Automation element is in an indeterminate state. 可用于指示用户是否已对控件执行操作。 can be used to indicate whether the user has acted on a control. 例如,复选框可显示为已选中并灰显,从而指示不确定状态。For example, a check box can appear checked and dimmed, indicating an indeterminate state. 创建不确定状态与禁用控件不同。Creating an indeterminate state is different from disabling the control. 因此,处于不确定状态的复选框仍然可以获得焦点。Consequently, a check box in the indeterminate state can still receive the focus. 当用户单击处于不确定状态的控件时,ToggleState 会循环至其下一个值。When the user clicks an indeterminate control, the ToggleState cycles to its next value.

Off 0

未选定、选中、标记或以其他方式激活 UI 自动化元素。The UI Automation element is not selected, checked, marked, or otherwise activated.

On 1

已选定、选中、标记或以其他方式激活 UI 自动化元素。The UI Automation element is selected, checked, marked, or otherwise activated.


控件必须IToggleProvider.ToggleState按以下顺序循环切换: OnOff和 (如果支持) IndeterminateA control must cycle through its IToggleProvider.ToggleState in this order: On, Off, and, if supported, Indeterminate.