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. 選擇性指定定位順序中要選取控制項的方向。Optionally specifies the direction in the tab order to select the control from.

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

啟動控制項。Activates the control.

備註

如果控制項的ControlStyles.Selectable樣式位設定為true,則方法會啟動控制項,它會包含在另一個控制項中,而且其所有父控制項都是可見和啟用的。SelectThe 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 Forms 控制項無法選取。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. 選擇性指定定位順序中要選取控制項的方向。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 會在定位順序中向前移動。false 會在定位順序中向後移動。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. 當參數設定為true時, forward會評估參數以決定要選取的控制項。 directedWhen the directed parameter is set to true, the forward parameter is evaluated to determine which control to select. forward設定為true時,會選取定位順序中的下一個控制項; 當false時,會選取定位順序中的上一個控制項。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
另請參閱

適用於