다음을 통해 공유


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

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

nested
Boolean

true중첩(자식 컨트롤의 자식) 자식 컨트롤을 포함하려면 그렇지 않으면 . false

wrap
Boolean

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

다음 코드 예제에서는 일부 다른 컨트롤이 있는 Button 폼에서 사용 되는 메서드를 보여 SelectNextControl 줍니다. 를 클릭하면 Button활성화된 다음 컨트롤이 Button 됩니다. 컨트롤의 부모를 가져와야 합니다 Button . Button 컨테이너가 아니므로 직접 호출 SelectNextControl 하면 Button 활성화가 변경되지 않습니다.

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

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

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

  1. Enter

  2. GotFocus

  3. Leave

  4. Validating

  5. Validated

  6. LostFocus

속성이 CausesValidation 설정된 falseValidating 경우 이벤트 및 Validated 이벤트가 표시되지 않습니다.

적용 대상

추가 정보