Control.Select Control.Select Control.Select Control.Select Method

定义

激活控件。Activates a control.

重载

Select(Boolean, Boolean) Select(Boolean, Boolean) Select(Boolean, Boolean) Select(Boolean, Boolean)

激活子控件。Activates a child control. 还可以指定从中选择控件的 Tab 键顺序的方向。Optionally specifies the direction in the tab order to select the control from.

Select() Select() Select() Select()

激活控件。Activates the control.

注解

Select方法激活的控件,如果控件的ControlStyles.Selectable样式位设置为true、 包含在另一个控件和所有其父控件均可见且已启用。The Select method activates the control if the control's ControlStyles.Selectable style bit is set to true, it is contained in another control, and all its parent controls are both visible and enabled.

以下列表中的 Windows 窗体控件不可选择。The Windows Forms controls in the following list are not selectable. 从列表中的控件派生的控件也不会选择。Controls derived from controls in the list will also not be selectable.

Select(Boolean, Boolean) Select(Boolean, Boolean) Select(Boolean, Boolean) Select(Boolean, Boolean)

激活子控件。Activates a child control. 还可以指定从中选择控件的 Tab 键顺序的方向。Optionally specifies the direction in the tab order to select the control from.

protected:
 virtual void Select(bool directed, bool forward);
protected virtual void Select (bool directed, bool forward);
abstract member Select : bool * bool -> unit
override this.Select : bool * bool -> unit
Protected Overridable Sub Select (directed As Boolean, forward As Boolean)

参数

directed
Boolean Boolean Boolean Boolean

如果指定要选择的控件的方向,则为 true;否则为 falsetrue to specify the direction of the control to select; otherwise, false.

forward
Boolean Boolean Boolean Boolean

如果为 true 则在 Tab 键顺序中前移;如果为 false 则在 Tab 键顺序中后移。true to move forward in the tab order; false to move backward in the tab order.

注解

directedforward参数由容器样式的控件。The directed and forward parameters are used by container-style controls. directed参数设置为true,则forward参数的计算结果来确定哪个控件进行选择。When the directed parameter is set to true, the forward parameter is evaluated to determine which control to select. forward设置为true,在 tab 键顺序中的下一个控件处于选中状态,当false,选择上一个控件的 tab 键顺序。When forward is set to true, the next control in the tab order is selected; when false, the previous control in the tab order is selected.

另请参阅

Select() Select() Select() Select()

激活控件。Activates the control.

public:
 void Select();
public void Select ();
member this.Select : unit -> unit
Public Sub Select ()

示例

下面的代码示例选择指定Control,则可选择。The following code example selects the specified Control, if it is selectable.

public:
   void ControlSelect( Control^ control )
   {
      
      // Select the control, if it can be selected.
      if ( control->CanSelect )
      {
         control->Select(  );
      }
   }
public void ControlSelect(Control control)
{
   // Select the control, if it can be selected.
   if(control.CanSelect)
   {
      control.Select();
   }
}
Public Sub ControlSelect(control As Control)
   ' Select the control, if it can be selected.
   If control.CanSelect Then
      control.Select()
   End If
End Sub
另请参阅

适用于