Control.Select 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
激活控件。
重载
| 名称 | 说明 |
|---|---|
| Select() |
激活控件。 |
| Select(Boolean, Boolean) |
激活子控件。 (可选)指定要从中选择控件的 Tab 键顺序中的方向。 |
注解
Select如果控件的ControlStyles.Selectable样式位设置为true控件,则该方法将激活控件,该控件包含在另一个控件中,并且其所有父控件均可见且已启用。
以下列表中的 Windows 窗体控件不可选择。 从列表中的控件派生的控件也不可选择。
- Label
- Panel
- GroupBox
- PictureBox
- ProgressBar
- Splitter
- LinkLabel (当控件中没有链接时)
Select()
- Source:
- Control.cs
- Source:
- Control.cs
- Source:
- Control.cs
- Source:
- Control.cs
- Source:
- Control.cs
激活控件。
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
另请参阅
适用于
Select(Boolean, Boolean)
- Source:
- Control.cs
- Source:
- Control.cs
- Source:
- Control.cs
- Source:
- Control.cs
- Source:
- Control.cs
激活子控件。 (可选)指定要从中选择控件的 Tab 键顺序中的方向。
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 在 Tab 键顺序中向前移动; false 以 Tab 键顺序向后移动。
注解
directed容器样式控件使用和forward参数。
directed将参数设置为true此参数时,forward将计算参数以确定要选择的控件。 如果 forward 设置为 true,则选择 Tab 键顺序中的下一个控件;当选中 Tab 键顺序中的上一个控件时 false。