Control.SelectNextControl(Control, Boolean, Boolean, Boolean, Boolean) Control.SelectNextControl(Control, Boolean, Boolean, Boolean, Boolean) Control.SelectNextControl(Control, Boolean, Boolean, Boolean, Boolean) Control.SelectNextControl(Control, Boolean, Boolean, Boolean, Boolean) Method

정의

다음 컨트롤을 활성화합니다.Activates the next control.

public:
 bool SelectNextControl(System::Windows::Forms::Control ^ ctl, bool forward, bool tabStopOnly, bool nested, bool wrap);
public bool SelectNextControl (System.Windows.Forms.Control ctl, bool forward, bool tabStopOnly, bool nested, bool wrap);
member this.SelectNextControl : System.Windows.Forms.Control * bool * bool * bool * bool -> bool
Public Function SelectNextControl (ctl As Control, forward As Boolean, tabStopOnly As Boolean, nested As Boolean, wrap As Boolean) As Boolean

매개 변수

ctl
Control Control Control Control

검색을 시작할 Control입니다.The Control at which to start the search.

forward
Boolean Boolean Boolean Boolean

탭 순서에서 앞으로 이동하려면 true이고, 뒤로 이동하려면 false입니다.true to move forward in the tab order; false to move backward in the tab order.

tabStopOnly
Boolean Boolean Boolean Boolean

true 속성이 TabStop로 설정된 컨트롤을 무시하려면 false이고, 그렇지 않으면 false입니다.true to ignore the controls with the TabStop property set to false; otherwise, false.

nested
Boolean Boolean Boolean Boolean

중첩된(자식 컨트롤의 자식) 자식 컨트롤을 포함시키려면 true이고, 그렇지 않으면 false입니다.true to include nested (children of child controls) child controls; otherwise, false.

wrap
Boolean Boolean Boolean Boolean

탭 순서의 마지막 컨트롤에 도달한 후 첫째 컨트롤부터 검색을 계속하려면 true이고, 그렇지 않으면 false입니다.true to continue searching from the first control in the tab order after the last control has been reached; otherwise, false.

반환

컨트롤이 활성화되었으면 true이고, 그렇지 않으면 false입니다.true if a control was activated; otherwise, false.

예제

다음 코드 exampleshows는 SelectNextControl 일부 컨트롤을 폼에 사용 되는 메서드.The following code exampleshows the SelectNextControl method being used in a form that has some controls. 폼을 클릭할 때마다 다음 컨트롤이 활성화 됩니다.Each time that you click the form, the next control is activated. ActiveControl 속성 컨테이너 컨트롤에서 현재 활성 컨트롤을 가져옵니다.The ActiveControl property gets the currently active control in the container control.

private void Form1_Click(object sender, EventArgs e)
{
    Control ctl;
    ctl = (Control)sender;
    ctl.SelectNextControl(ActiveControl, true, true, true, true);
}
Private Sub Form1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Click
    Dim ctl As Control
    ctl = CType(sender, Control)
    ctl.SelectNextControl(ActiveControl, True, True, True, True)
End Sub

다음 코드 예제는 SelectNextControl 있는 폼에 사용 되는 메서드를 Button 및 일부 기타 컨트롤입니다.The following code example shows the SelectNextControl method being used in a form that has a Button and some other controls. 클릭할 때 합니다 Button, 후 다음 컨트롤로 Button 활성화 됩니다.When you click the Button, the next control after the Button is activated. 부모를 가져오려는 것을 확인할는 Button 제어 합니다.Notice that you have to get the parent of the Button control. 이후 Button 는 컨테이너가 아닙니다 호출 SelectNextControl 에 직접는 Button 활성화를 변경 하지 않으므로 합니다.Since Button is not a container, calling SelectNextControl directly on the Button would not change the activation.

private void button1_Click(object sender, EventArgs e)
{
    Control p;
    p = ((Button) sender).Parent;
    p.SelectNextControl(ActiveControl, true, true, true, true);
}
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
    Dim p As Control
    p = CType(sender, Button).Parent
    p.SelectNextControl(ActiveControl, True, True, True, True)
End Sub

설명

합니다 SelectNextControl 메서드 탭 순서의 다음 컨트롤로 활성화 하는 경우 컨트롤의 Selectable 스타일 비트가 true 에서 ControlStyles, 다른 컨트롤에 포함 된와 모든 부모 컨트롤 모두 표시 되 고 사용 하도록 설정 합니다.The SelectNextControl method activates the next control in the tab order if the control's Selectable style bit is set to true in ControlStyles, 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.

호출 하 여 키보드 (TAB, SHIFT + TAB 등)를 사용 하 여 포커스를 변경 하면 합니다 Select 또는 SelectNextControl 메서드를 설정 하거나를 ContainerControl.ActiveControl 속성을 현재 폼에 포커스 이벤트가 다음 순서 대로 발생:When you change the focus by using the keyboard (TAB, SHIFT+TAB, and so on), by calling the Select or SelectNextControl methods, or by setting the ContainerControl.ActiveControl property to the current form, focus events occur in the following order:

  1. Enter

  2. GotFocus

  3. Leave

  4. Validating

  5. Validated

  6. LostFocus

경우는 CausesValidation 속성이 falseValidatingValidated 이벤트는 표시 되지 않습니다.If the CausesValidation property is set to false, the Validating and Validated events are suppressed.

적용 대상

추가 정보