Control.SelectNextControl(Control, Boolean, Boolean, Boolean, Boolean) 메서드

정의

다음 컨트롤을 활성화합니다.

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);
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입니다.

forward
Boolean

탭 순서에서 앞으로 이동하려면 true이고, 뒤로 이동하려면 false입니다.

tabStopOnly
Boolean

true 속성이 TabStop로 설정된 컨트롤을 무시하려면 false이고, 그렇지 않으면 false입니다.

nested
Boolean

중첩된(자식 컨트롤의 자식) 자식 컨트롤을 포함시키려면 true이고, 그렇지 않으면 false입니다.

wrap
Boolean

탭 순서의 마지막 컨트롤에 도달한 후 첫째 컨트롤부터 검색을 계속하려면 true이고, 그렇지 않으면 false입니다.

반환

컨트롤이 활성화되었으면 true이고, 그렇지 않으면 false입니다.

예제

다음 코드 예제에서는 일부 컨트롤이 SelectNextControl 있는 양식에서 사용 되는 메서드를 표시 합니다. 양식을 클릭할 때마다 다음 컨트롤이 활성화됩니다. 속성은 ActiveControl 컨테이너 컨트롤에서 현재 활성 컨트롤을 가져옵니다.

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 다른 컨트롤입니다. 를 Button클릭하면 다음 컨트롤 Button 이 활성화됩니다. 컨트롤의 Button 부모를 가져와야 합니다. Button 가 컨테이너가 아니므로 에서 Button 직접 를 호출 SelectNextControl 해도 활성화가 변경되지 않습니다.

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 스타일 비트가 에서 로 trueControlStyles설정된 경우 탭 순서에서 다음 컨트롤을 활성화하고 다른 컨트롤에 포함되며 모든 부모 컨트롤이 표시되고 활성화됩니다.

다음 목록의 Windows Forms 컨트롤을 선택할 수 없습니다. 목록의 컨트롤에서 파생된 컨트롤도 선택할 수 없습니다.

호출 하 여 키보드 (TAB, SHIFT + TAB 등)를 사용 하 여 포커스를 변경 하면 합니다 Select 또는 SelectNextControl 메서드를 설정 하거나를 ContainerControl.ActiveControl 속성을 현재 폼에 포커스 이벤트가 다음 순서 대로 발생:

  1. Enter

  2. GotFocus

  3. Leave

  4. Validating

  5. Validated

  6. LostFocus

경우는 CausesValidation 속성이 falseValidatingValidated 이벤트는 표시 되지 않습니다.

적용 대상

추가 정보