共用方式為


Control.CanSelect 屬性

定義

會得到一個值,表示是否可以選擇該控制項。

public:
 property bool CanSelect { bool get(); };
[System.ComponentModel.Browsable(false)]
public bool CanSelect { get; }
[<System.ComponentModel.Browsable(false)>]
member this.CanSelect : bool
Public ReadOnly Property CanSelect As Boolean

屬性值

true如果可以選擇控制點;否則,。 false

屬性

範例

以下程式碼範例選擇指定的 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

備註

SelectableSystem.Windows.Forms.ControlStyles值被設定為 true,且包含在另一個控制項中,且控制項本身可見且啟用,且所有父控制項都可見且啟用時,則此屬性會回傳true

以下列表中的 Windows 表單控制項無法選擇,且該屬性會回傳 的falseCanSelect值。 由這些控制項衍生出的控制項也無法選擇。

適用於

另請參閱