다음을 통해 공유


SplitContainer.TabStop 속성

정의

사용자가 TAB 키를 사용하여 분할자에게 포커스를 제공할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool TabStop { bool get(); void set(bool value); };
public bool TabStop { get; set; }
member this.TabStop : bool with get, set
Public Property TabStop As Boolean

속성 값

true사용자가 TAB 키를 사용하여 분할자에게 포커스를 제공할 수 있으면 이고, 그렇지 않으면 . false 기본값은 true입니다.

설명

사용자가 TAB 키를 누르면 입력 포커스가 폼의 탭 순서로 다음 컨트롤로 설정됩니다. true 화살표 키와 마우스를 사용하여 이동할 수 있도록 분할터에 입력 포커스를 지정하도록 설정합니다TabStop. .NET Framework 4부터 분할자 및 탭 순서의 컨트롤 컬렉션에 SplitContainer 포함된 컨트롤을 제외하도록 false 설정합니다TabStop. TAB 키를 사용하여 컨트롤이 포커스를 가져올 수 있도록 하려면 상속되는 컨트롤을 만듭니다 SplitContainer. 명명 TabStop 된 새 속성을 만들고 메서드를 재정의합니다 ProcessTabKey . 다음 예제에서는 이 작업을 수행하는 방법을 보여 줍니다.

public class MySplitContainer : SplitContainer
{
    private bool tabStop = true;
    public new bool TabStop
    {
        get
        {
            return tabStop;
        }
        set
        {
            if (TabStop != value)
            {
                tabStop = value;
                OnTabStopChanged(EventArgs.Empty);
            }
        }
    }

    protected override bool ProcessTabKey(bool forward)
    {
        if (!tabStop)
        {
            if (SelectNextControl(ActiveControl, forward, true, true, false)) return true;
        }
        return base.ProcessTabKey(forward);
    }
}
Public Class MySplitContainer
    Inherits SplitContainer
    Private m_tabStop As Boolean = True
    Public Shadows Property TabStop() As Boolean
        Get
            Return m_tabStop
        End Get
        Set(ByVal value As Boolean)
            If TabStop <> value Then
                m_tabStop = value
                OnTabStopChanged(EventArgs.Empty)
            End If
        End Set
    End Property

    Protected Overloads Overrides Function ProcessTabKey(ByVal forward As Boolean) As Boolean
        If Not m_tabStop Then
            If SelectNextControl(ActiveControl, forward, True, True, False) Then
                Return True
            End If
        End If
        Return MyBase.ProcessTabKey(forward)
    End Function

    Public Function ShouldSerializeTabStop() As Boolean
        Return True
    End Function
End Class

컨트롤의 TabIndex 속성 값을 설정하여 탭 순서를 조작할 수 있습니다.

적용 대상

추가 정보