AccessibleObject.DoDefaultAction AccessibleObject.DoDefaultAction AccessibleObject.DoDefaultAction AccessibleObject.DoDefaultAction Method

定义

执行与该辅助性对象相关的默认操作。Performs the default action associated with this accessible object.

public:
 virtual void DoDefaultAction();
public virtual void DoDefaultAction ();
abstract member DoDefaultAction : unit -> unit
override this.DoDefaultAction : unit -> unit
Public Overridable Sub DoDefaultAction ()

异常

无法执行该控件的默认操作。The default action for the control cannot be performed.

注解

客户端可以通过检查对象的DefaultAction属性来检索对象的默认操作。Clients can retrieve the object's default action by inspecting an object's DefaultAction property. 客户端可以使用自动化 (如果支持) DoDefaultAction , 而不是执行对象的默认操作。A client can use automation (if supported) instead of DoDefaultAction to perform an object's default action. 但是, DoDefaultAction提供了一种简单的方法来执行对象的最常用操作。However, DoDefaultAction provides an easy way to perform an object's most commonly used action.

继承者说明

系统提供的用户界面元素所执行的默认操作取决于键盘状态。The default action performed by system-provided user interface elements depends on the keyboard state. 也就是说, 当调用时DoDefaultAction() , 如果修改键 (如 SHIFT、ALT 或 CTRL 为关闭状态 (通过用户操作或以编程方式) 关闭, 则默认操作可能不同于这些键未关闭的情况。That is, if a modifier key such as SHIFT, ALT, or CTRL is down (either by a user action or programmatically) when DoDefaultAction() is called, the default action might not be the same as when those keys are not down. 并非所有对象都有默认操作。Not all objects have a default action.

适用于