Control.Select 方法

定義

啟動控制項。

多載

Select(Boolean, Boolean)

啟動子控制項。 選擇性指定定位順序中要選取控制項的方向。

Select()

啟動控制項。

備註

如果 Select 控制項的 ControlStyles.Selectable 樣式位設定 true 為 ,則方法會啟動控制項,它包含在另一個控制項中,而且其所有父控制項都是可見且啟用的。

下列清單中的Windows Forms控制項無法選取。 衍生自清單中控制項的控制項也無法選取。

Select(Boolean, Boolean)

啟動子控制項。 選擇性指定定位順序中要選取控制項的方向。

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

true 以指定要選取控制項的方向,否則為 false

forward
Boolean

true 會在定位順序中向前移動。false 會在定位順序中向後移動。

備註

directedforward 參數是由容器樣式控制項使用。 directed當 參數設定為 true 時,會 forward 評估 參數,以判斷要選取的控制項。 當 設定為 trueforward ,會選取定位順序中的下一個控制項;當 選取索引 false 標籤順序中的上一個控制項時。

另請參閱

適用於

Select()

啟動控制項。

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

範例

下列程式碼範例會選取指定的 Control ,如果它是可選取的。

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

另請參閱

適用於