Splitter Splitter Splitter Constructor

정의

Splitter 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the Splitter class. Splitter 바뀌었습니다 SplitContainer, 이전 버전과 호환성을 위해서만 제공 됩니다.Splitter has been replaced by SplitContainer, and is provided only for compatibility with previous versions.

public:
 Splitter();
public Splitter ();
Public Sub New ()

예제

다음 코드 예제에서는 한 Splitter 컨트롤과 함께 TreeViewListView 창을 Windows 탐색기와 비슷한 만들려면 컨트롤입니다.The following code example uses a Splitter control in combination with TreeView and ListView controls to create a window similar to Windows Explorer. 식별 하는 TreeViewListView 컨트롤, 노드 및 항목은 두 컨트롤에 추가 됩니다.To identify the TreeView and ListView controls, nodes and items are added to both controls. 예제에서는 MinExtraMinSize 의 속성을 Splitter 방지 하기 위해를 TreeView 또는 ListView 너무 작거나 너무 큰 크기 중에서 컨트롤입니다.The example uses the MinExtra and MinSize properties of the Splitter to prevent the TreeView or ListView control from being sized too small or too large. 이 예제에서는이 예제에서 만든 메서드 내에서 정의 되어 있어야를 Form 의 생성자에서 메서드가 호출 되는 및를 Form입니다.This example requires that the method created in this example is defined within a Form and that the method is called from the constructor of the Form.

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.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 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

설명

기본적으로 MinSizeMinExtra 속성을 25로 설정 합니다.By default, the MinSize and MinExtra properties are set to 25. 합니다 Dock 속성이 DockStyle.Left 기본적으로 합니다.The Dock property is set to DockStyle.Left by default.

적용 대상