Splitter 클래스

사용자가 도킹된 컨트롤의 크기를 조정할 수 있게 하는 Splitter 컨트롤을 나타냅니다. SplitterSplitContainer로 대체되었으며 이전 버전과의 호환성을 위해서만 제공됩니다.

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
Public Class Splitter
    Inherits Control
‘사용 방법
Dim instance As Splitter
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
public class Splitter : Control
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
public ref class Splitter : public Control
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
public class Splitter extends Control
ComVisibleAttribute(true) 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
public class Splitter extends Control

설명

Splitter 컨트롤을 사용하면 사용자가 런타임에 Splitter 컨트롤의 가장자리에 도킹된 컨트롤의 크기를 조정할 수 있습니다. Splitter 컨트롤 위로 마우스 포인터를 가져가면 커서가 바뀌어 Splitter 컨트롤에 도킹된 컨트롤의 크기를 조정할 수 있음을 나타냅니다. Splitter 컨트롤을 사용하면 도킹 순서에서 바로 앞에 있는 도킹된 컨트롤의 크기를 조정할 수 있습니다. 따라서 사용자가 도킹된 컨트롤의 크기를 조정할 수 있게 하려면 사용자가 크기를 조정할 수 있는 컨트롤을 컨테이너의 가장자리에 도킹한 다음 해당 컨트롤의 같은 쪽에 분할자를 도킹합니다. 예를 들어, Windows 탐색기와 유사한 창을 만들려면 폼에 TreeView 컨트롤을 추가한 다음 Dock 속성을 DockStyle.Left로 설정합니다. 또한, 폼에 Splitter 컨트롤을 추가한 다음 Dock 속성을 DockStyle.Left로 설정합니다. 폼 레이아웃을 완성하려면 ListView 컨트롤을 추가하고 Dock 속성을 DockStyle.Fill로 설정하여 ListView가 폼의 나머지 공간을 차지하게 만듭니다. 이렇게 하면 런타임에 Splitter 컨트롤을 이동하여 ListView 컨트롤뿐 아니라 TreeView 컨트롤의 너비도 조정할 수 있습니다.

Splitter 컨트롤이 도킹된 컨트롤을 너무 작은 크기로 조정하지 않도록 하려면 MinExtraMinSize 속성을 사용합니다. 좌우로 도킹된 컨트롤(가로 Splitter 컨트롤의 경우에는 상하)의 가능한 최소 크기는 MinExtraMinSize 속성에 의해 결정됩니다. Splitter 컨트롤이 도킹된 폼의 다른 컨트롤에 특정 스타일의 테두리를 표시하려면 BorderStyle 속성을 사용하여 해당 폼에 도킹된 컨트롤의 테두리 스타일을 일치시킵니다.

Splitter 컨트롤이 도킹된 컨트롤의 최대 크기 한계를 설정하는 것이 필요할 수 있습니다. SplitterMovedSplitterMoving 이벤트를 사용하면 사용자가 도킹된 컨트롤의 크기를 조정한 시간을 확인할 수 있습니다. SplitterMoved 또는 SplitterMoving 이벤트에 대한 이벤트 처리기에서 SplitPosition 속성을 사용하면 Splitter 컨트롤이 도킹된 컨트롤의 크기를 확인할 수 있으며, SplitPosition 속성을 설정하여 도킹된 컨트롤의 너비(또는 가로로 정렬된 Splitter 컨트롤의 경우 높이)를 지정된 최대 너비로 제한할 수 있습니다.

참고

Splitter 컨트롤을 사용하여 컨트롤의 크기를 조정하는 작업은 마우스로만 수행할 수 있습니다. 키보드로는 Splitter 컨트롤에 액세스할 수 없습니다.

예제

다음 코드 예제에서는 TreeViewListView 컨트롤과 함께 Splitter 컨트롤을 사용하여 Windows 탐색기와 유사한 창을 만듭니다. TreeViewListView 컨트롤을 확인할 수 있도록 두 컨트롤에 노드와 항목이 추가됩니다. 예제에서는 SplitterMinExtraMinSize 속성을 사용하여 TreeView 컨트롤이나 ListView 컨트롤의 크기가 너무 작게 또는 너무 크게 조정되지 않도록 합니다. 이 예제에서 만든 메서드가 Form 내에 정의되고 이 메서드가 Form의 생성자로부터 호출되어야 합니다.

Private Sub CreateMySplitControls()
   ' Create TreeView, ListView, and Splitter controls.
   Dim treeView1 As New TreeView()
   Dim listView1 As New ListView()
   Dim splitter1 As New Splitter()
   
   ' Set the TreeView control to dock to the left side of the form.
   treeView1.Dock = DockStyle.Left
   ' Set the Splitter to dock to the left side of the TreeView control.
   splitter1.Dock = DockStyle.Left
   ' Set the minimum size the ListView control can be sized to.
      splitter1.MinExtra = 100
   ' Set the minimum size the TreeView control can be sized to.
      splitter1.MinSize = 75
   ' Set the ListView control to fill the remaining space on the form.
      listView1.Dock = DockStyle.Fill

      ' Add a TreeView and a ListView item to identify the controls on the form.
      treeView1.Nodes.Add("TreeView Node")
      listView1.Items.Add("ListView Item")
   
   ' Add the controls in reverse order to the form to ensure proper location.
   Me.Controls.AddRange(New Control() {listView1, splitter1, treeView1})
End Sub 'CreateMySplitControls
private void CreateMySplitControls()
{
    // Create TreeView, ListView, and Splitter controls.
    TreeView treeView1 = new TreeView();
    ListView listView1 = new ListView();
    Splitter splitter1 = new Splitter();

    // Set the TreeView control to dock to the left side of the form.
    treeView1.Dock = DockStyle.Left;
    // Set the Splitter to dock to the left side of the TreeView control.
    splitter1.Dock = DockStyle.Left;
    // Set the minimum size the ListView control can be sized to.
    splitter1.MinExtra = 100;
    // Set the minimum size the TreeView control can be sized to.
    splitter1.MinSize = 75;
    // Set the ListView control to fill the remaining space on the form.
    listView1.Dock = DockStyle.Fill;
    // Add a TreeView and a ListView item to identify the controls on the form.
    treeView1.Nodes.Add("TreeView Node");
    listView1.Items.Add("ListView Item");

    // Add the controls in reverse order to the form to ensure proper location.
    this.Controls.AddRange(new Control[]{listView1, splitter1, treeView1});
}
private:
   void CreateMySplitControls()
   {
      // Create TreeView, ListView, and Splitter controls.
      TreeView^ treeView1 = gcnew TreeView;
      ListView^ listView1 = gcnew ListView;
      Splitter^ splitter1 = gcnew Splitter;

      // Set the TreeView control to dock to the left side of the form.
      treeView1->Dock = DockStyle::Left;

      // Set the Splitter to dock to the left side of the TreeView control.
      splitter1->Dock = DockStyle::Left;

      // Set the minimum size the ListView control can be sized to.
      splitter1->MinExtra = 100;

      // Set the minimum size the TreeView control can be sized to.
      splitter1->MinSize = 75;

      // Set the ListView control to fill the remaining space on the form.
      listView1->Dock = DockStyle::Fill;

      // Add a TreeView and a ListView item to identify the controls on the form.
      treeView1->Nodes->Add( "TreeView Node" );
      listView1->Items->Add( "ListView Item" );

      // Add the controls in reverse order to the form to ensure proper location.
      array<Control^>^temp0 = {listView1,splitter1,treeView1};
      this->Controls->AddRange( temp0 );
   }
private void CreateMySplitControls()
{
    // Create TreeView, ListView, and Splitter controls.
    TreeView treeView1 = new TreeView();
    ListView listView1 = new ListView();
    Splitter splitter1 = new Splitter();
    // Set the TreeView control to dock to the left side of the form.
    treeView1.set_Dock(DockStyle.Left);
    // Set the Splitter to dock to the left side of the TreeView control.
    splitter1.set_Dock(DockStyle.Left);
    // Set the minimum size the ListView control can be sized to.
    splitter1.set_MinExtra(100);
    // Set the minimum size the TreeView control can be sized to.
    splitter1.set_MinSize(75);
    // Set the ListView control to fill the remaining space on the form.
    listView1.set_Dock(DockStyle.Fill);
    // Add a TreeView and a ListView item to identify the controls on the 
    // form.
    treeView1.get_Nodes().Add("TreeView Node");
    listView1.get_Items().Add("ListView Item");
    // Add the controls in reverse order to the form to ensure proper 
    // location.
    this.get_Controls().AddRange(new Control[] { listView1, splitter1, 
        treeView1 });
} //CreateMySplitControls

상속 계층 구조

System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
       System.Windows.Forms.Control
        System.Windows.Forms.Splitter

스레드로부터의 안전성

이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0에서 지원

참고 항목

참조

Splitter 멤버
System.Windows.Forms 네임스페이스
TreeView
ListView 클래스