Control.CanSelect 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會得到一個值,表示是否可以選擇該控制項。
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
備註
當 Selectable 的System.Windows.Forms.ControlStyles值被設定為 true,且包含在另一個控制項中,且控制項本身可見且啟用,且所有父控制項都可見且啟用時,則此屬性會回傳true。
以下列表中的 Windows 表單控制項無法選擇,且該屬性會回傳 的falseCanSelect值。 由這些控制項衍生出的控制項也無法選擇。
LinkLabel (當控制中沒有連結時)