SplitContainer クラスとは? わかりやすく解説

SplitContainer クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

コンテナ表示領域2 つサイズ変更可能なパネル分割する移動可能なバー構成されるコントロール表します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
Public Class SplitContainer
    Inherits ContainerControl
Dim instance As SplitContainer
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
public class SplitContainer : ContainerControl
[ComVisibleAttribute(true)] 
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
public ref class SplitContainer : public
 ContainerControl
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
public class SplitContainer extends ContainerControl
ComVisibleAttribute(true) 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
public class SplitContainer extends
 ContainerControl
解説解説

2 つサイズ変更可能なパネルコントロール追加したり、既存SplitContainer パネル別の SplitContainer コントロール追加して多くサイズ変更可能な表示領域作成したできます

SplitContainer コントロール使用すると、コンテナ (Form など) の表示領域分割しユーザーSplitContainer パネル追加されるコントロールサイズ変更できるようになりますユーザー分割線上マウス ポインタ通過させると、カーソル変化しSplitContainer コントロール内のコントロールサイズ変更できることが示されます。

メモメモ

以前のバージョン.NET Framework では、Splitter コントロールのみサポートされています。

また SplitContainer により、デザイン時のコントロール配置容易になります。たとえば、Windows エクスプローラ類似したウィンドウ作成するには、SplitContainer コントロールForm追加し、その Dock プロパティDockStyle.Fill設定します次に、TreeView コントロールForm追加し、その Dock プロパティDockStyle.Fill設定しますListView コントロール追加し、その Dock プロパティDockStyle.Fill設定してForm 上の残り領域いっぱいListView表示しレイアウト完成させます。これで、実行時ユーザー分割線を使用して両方コントロールの幅変更できるようになります。FixedPanel プロパティ使用すると、Formその他のコンテナ合わせてコントロールサイズ変更しないよう指定できます

SplitterDistance を使用すると、フォーム上の分割線の開始位置指定できますまた、SplitterIncrement を使用すると、分割線が一度移動するピクセル数指定できますSplitterIncrement既定値は 1 ピクセルです。

Panel1MinSize および Panel2MinSize を使用すると、分割線と SplitContainer パネルの外端との最短距離指定できますパネル既定最小サイズ25 ピクセルです。

Orientation プロパティ使用すると、平面上の方向指定できますSplitContainer既定方向は垂直です。

BorderStyle プロパティ使用すると、SplitContainer境界線スタイル指定してSplitContainer追加するコントロール境界線スタイル連動させることができます

使用例使用例

次のコード例は、垂直方向と水平方向両方SplitContainer示してます。直方向の分割線は、10 ピクセル単位移動します。垂直方向の SplitContainer左側パネルには TreeView コントロール配置され右側パネルには水平方向SplitContainer配置されています。水平方向SplitContainer両側にあるパネルには、ListView コントロールいっぱい表示されています。上側パネルFixedPanel として定義されているため、コンテナサイズ変更してサイズ変更されません。垂直方向の分割線を移動すると SplitterMoving イベント発生します。この例では、カーソル スタイルの変更によって、このイベントの発生通知されます。分割線の移動中止されると、SplitterMoved イベント発生します。この例では、カーソル スタイル既定スタイルに戻ることによって、このイベントの発生通知されます。

' Compile this example using the following command line:
' vbc basicsplitcontainer.vb /r:System.Drawing.dll /r:System.Windows.Forms.dll
 /r:System.dll /r:System.Data.dll
Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports Microsoft.VisualBasic

Public Class Form1
    Inherits System.Windows.Forms.Form
    Private WithEvents splitContainer1 As
 System.Windows.Forms.SplitContainer
    Private treeView1 As System.Windows.Forms.TreeView
    Private splitContainer2 As System.Windows.Forms.SplitContainer
    Private listView2 As System.Windows.Forms.ListView
    Private listView1 As System.Windows.Forms.ListView
   
    Public Sub New()
        InitializeComponent()
    End Sub 'New
       
    Private Sub InitializeComponent()
        splitContainer1 = New System.Windows.Forms.SplitContainer()
        treeView1 = New System.Windows.Forms.TreeView()
        splitContainer2 = New System.Windows.Forms.SplitContainer()
        listView1 = New System.Windows.Forms.ListView()
        listView2 = New System.Windows.Forms.ListView()
        splitContainer1.SuspendLayout()
        splitContainer2.SuspendLayout()
        SuspendLayout()
        ' Basic SplitContainer properties.
        ' This is a vertical splitter that moves in 10-pixel increments.
        ' This splitter needs no explicit Orientation property because
 Vertical is the default.
        splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
        splitContainer1.ForeColor = System.Drawing.SystemColors.Control
        splitContainer1.Location = New System.Drawing.Point(0,
 0)
        splitContainer1.Name = "splitContainer1"
        ' You can drag the splitter no nearer than 30 pixels from the
 left edge of the container.
        splitContainer1.Panel1MinSize = 30
        ' You can drag the splitter no nearer than 20 pixels from the
 right edge of the container.
        splitContainer1.Panel2MinSize = 20
        splitContainer1.Size = New System.Drawing.Size(292, 273)
        splitContainer1.SplitterDistance = 79
        ' This splitter moves in 10-pixel increments.
        splitContainer1.SplitterIncrement = 10
        splitContainer1.SplitterWidth = 6
        ' splitContainer1 is the first control in the tab order.
        splitContainer1.TabIndex = 0
        splitContainer1.Text = "splitContainer1"
          
        ' Add a TreeView control to the left panel.
        splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.Control
        ' Add a TreeView control to Panel1.
        splitContainer1.Panel1.Controls.Add(treeView1)
        splitContainer1.Panel1.Name = "splitterPanel1"
        ' Controls placed on Panel1 support right-to-left fonts.
        splitContainer1.Panel1.RightToLeft = System.Windows.Forms.RightToLeft.Yes

        ' Add a SplitContainer to the right panel.
        splitContainer1.Panel2.Controls.Add(splitContainer2)
        splitContainer1.Panel2.Name = "splitterPanel2"
          
        ' This TreeView control is in Panel1 of splitContainer1.
        treeView1.Dock = System.Windows.Forms.DockStyle.Fill
        treeView1.ForeColor = System.Drawing.SystemColors.InfoText
        treeView1.ImageIndex = - 1
        treeView1.Location = New System.Drawing.Point(0, 0)
        treeView1.Name = "treeView1"
        treeView1.SelectedImageIndex = - 1
        treeView1.Size = New System.Drawing.Size(79, 273)
        ' treeView1 is the second control in the tab order.
        treeView1.TabIndex = 1
          
        ' Basic SplitContainer properties.
        ' This is a horizontal splitter whose top and bottom panels
 are ListView controls. The top panel is fixed.
        splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill
        ' The top panel remains the same size when the form is resized.
        splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1
        splitContainer2.Location = New System.Drawing.Point(0,
 0)
        splitContainer2.Name = "splitContainer2"
        ' Create the horizontal splitter.
        splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal
        splitContainer2.Size = New System.Drawing.Size(207, 273)
        splitContainer2.SplitterDistance = 125
        splitContainer2.SplitterWidth = 6
        ' splitContainer2 is the third control in the tab order.
        splitContainer2.TabIndex = 2
        splitContainer2.Text = "splitContainer2"

        ' This splitter panel contains the top ListView control.
        splitContainer2.Panel1.Controls.Add(listView1)
        splitContainer2.Panel1.Name = "splitterPanel3"
          
        ' This splitter panel contains the bottom ListView control.
        splitContainer2.Panel2.Controls.Add(listView2)
        splitContainer2.Panel2.Name = "splitterPanel4"
          
        ' This ListView control is in the top panel of splitContainer2.
        listView1.Dock = System.Windows.Forms.DockStyle.Fill
        listView1.Location = New System.Drawing.Point(0, 0)
        listView1.Name = "listView1"
        listView1.Size = New System.Drawing.Size(207, 125)
        ' listView1 is the fourth control in the tab order.
        listView1.TabIndex = 3
          
        ' This ListView control is in the bottom panel of splitContainer2.
        listView2.Dock = System.Windows.Forms.DockStyle.Fill
        listView2.Location = New System.Drawing.Point(0, 0)
        listView2.Name = "listView2"
        listView2.Size = New System.Drawing.Size(207, 142)
        ' listView2 is the fifth control in the tab order.
        listView2.TabIndex = 4
          
        ' These are basic properties of the form.
        ClientSize = New System.Drawing.Size(292, 273)
        Controls.Add(splitContainer1)
        Name = "Form1"
        Text = "Form1"
        splitContainer1.ResumeLayout(False)
        splitContainer2.ResumeLayout(False)
        ResumeLayout(False)
    End Sub 'InitializeComponent
       
       
<STAThread()>  _
Shared Sub Main()
    Application.Run(New Form1())
End Sub 'Main
    
Private Sub splitContainer1_SplitterMoving(sender
 As System.Object, e As System.Windows.Forms.SplitterCancelEventArgs)
 Handles splitContainer1.SplitterMoving
    ' As the splitter moves, change the cursor type.
    Cursor.Current = System.Windows.Forms.Cursors.NoMoveVert
End Sub 'splitContainer1_SplitterMoving
    
Private Sub splitContainer1_SplitterMoved(sender
 As System.Object, e As System.Windows.Forms.SplitterEventArgs)
 Handles splitContainer1.SplitterMoved
    ' When the splitter stops moving, change the cursor back to the
 default.
    Cursor.Current = System.Windows.Forms.Cursors.Default
End Sub 'splitContainer1_SplitterMoved
End Class 'Form1
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class Form1 : System.Windows.Forms.Form
{
    private System.Windows.Forms.SplitContainer splitContainer1;
    private System.Windows.Forms.TreeView treeView1;
    private System.Windows.Forms.SplitContainer splitContainer2;
    private System.Windows.Forms.ListView listView2;
    private System.Windows.Forms.ListView listView1;

    public Form1()
    {
    InitializeComponent();
    }
    private void InitializeComponent()
    {
        splitContainer1 = new System.Windows.Forms.SplitContainer();
        treeView1 = new System.Windows.Forms.TreeView();
        splitContainer2 = new System.Windows.Forms.SplitContainer();
        listView1 = new System.Windows.Forms.ListView();
        listView2 = new System.Windows.Forms.ListView();
        splitContainer1.SuspendLayout();
        splitContainer2.SuspendLayout();
        SuspendLayout();

        // Basic SplitContainer properties.
        // This is a vertical splitter that moves in 10-pixel increments.
        // This splitter needs no explicit Orientation property because
 Vertical is the default.
        splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
        splitContainer1.ForeColor = System.Drawing.SystemColors.Control;
        splitContainer1.Location = new System.Drawing.Point(0,
 0);
        splitContainer1.Name = "splitContainer1";
        // You can drag the splitter no nearer than 30 pixels from the
 left edge of the container.
        splitContainer1.Panel1MinSize = 30;
        // You can drag the splitter no nearer than 20 pixels from the
 right edge of the container.
        splitContainer1.Panel2MinSize = 20;
        splitContainer1.Size = new System.Drawing.Size(292, 273);
        splitContainer1.SplitterDistance = 79;
        // This splitter moves in 10-pixel increments.
        splitContainer1.SplitterIncrement = 10;
        splitContainer1.SplitterWidth = 6;
        // splitContainer1 is the first control in the tab order.
        splitContainer1.TabIndex = 0;
        splitContainer1.Text = "splitContainer1";
        // When the splitter moves, the cursor changes shape.
        splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(splitContainer1_SplitterMoved);
        splitContainer1.SplitterMoving += new System.Windows.Forms.SplitterCancelEventHandler(splitContainer1_SplitterMoving);

        // Add a TreeView control to the left panel.
        splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.Control;
        // Add a TreeView control to Panel1.
        splitContainer1.Panel1.Controls.Add(treeView1);
        splitContainer1.Panel1.Name = "splitterPanel1";
        // Controls placed on Panel1 support right-to-left fonts.
        splitContainer1.Panel1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;


        // Add a SplitContainer to the right panel.
        splitContainer1.Panel2.Controls.Add(splitContainer2);
        splitContainer1.Panel2.Name = "splitterPanel2";

        // This TreeView control is in Panel1 of splitContainer1.
        treeView1.Dock = System.Windows.Forms.DockStyle.Fill;
        treeView1.ForeColor = System.Drawing.SystemColors.InfoText;
        treeView1.ImageIndex = -1;
        treeView1.Location = new System.Drawing.Point(0, 0);
        treeView1.Name = "treeView1";
        treeView1.SelectedImageIndex = -1;
        treeView1.Size = new System.Drawing.Size(79, 273);
        // treeView1 is the second control in the tab order.
        treeView1.TabIndex = 1;

        // Basic SplitContainer properties.
        // This is a horizontal splitter whose top and bottom panels
 are ListView controls. The top panel is fixed.
        splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
        // The top panel remains the same size when the form is resized.
        splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
        splitContainer2.Location = new System.Drawing.Point(0,
 0);
        splitContainer2.Name = "splitContainer2";
        // Create the horizontal splitter.
        splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
        splitContainer2.Size = new System.Drawing.Size(207, 273);
        splitContainer2.SplitterDistance = 125;
        splitContainer2.SplitterWidth = 6;
        // splitContainer2 is the third control in the tab order.
        splitContainer2.TabIndex = 2;
        splitContainer2.Text = "splitContainer2";

        // This splitter panel contains the top ListView control.
        splitContainer2.Panel1.Controls.Add(listView1);
        splitContainer2.Panel1.Name = "splitterPanel3";

        // This splitter panel contains the bottom ListView control.
        splitContainer2.Panel2.Controls.Add(listView2);
        splitContainer2.Panel2.Name = "splitterPanel4";

        // This ListView control is in the top panel of splitContainer2.
        listView1.Dock = System.Windows.Forms.DockStyle.Fill;
        listView1.Location = new System.Drawing.Point(0, 0);
        listView1.Name = "listView1";
        listView1.Size = new System.Drawing.Size(207, 125);
        // listView1 is the fourth control in the tab order.
        listView1.TabIndex = 3;

        // This ListView control is in the bottom panel of splitContainer2.
        listView2.Dock = System.Windows.Forms.DockStyle.Fill;
        listView2.Location = new System.Drawing.Point(0, 0);
        listView2.Name = "listView2";
        listView2.Size = new System.Drawing.Size(207, 142);
        // listView2 is the fifth control in the tab order.
        listView2.TabIndex = 4;
        
        // These are basic properties of the form.
        ClientSize = new System.Drawing.Size(292, 273);
        Controls.Add(splitContainer1);
        Name = "Form1";
        Text = "Form1";
        splitContainer1.ResumeLayout(false);
        splitContainer2.ResumeLayout(false);
        ResumeLayout(false);
    }

    [STAThread]
    static void Main() 
    {
        Application.Run(new Form1());
    }
    private void splitContainer1_SplitterMoving(System.Object
 sender, System.Windows.Forms.SplitterCancelEventArgs e)
    {
    // As the splitter moves, change the cursor type.
    Cursor.Current = System.Windows.Forms.Cursors.NoMoveVert;
    }
    private void splitContainer1_SplitterMoved(System.Object
 sender, System.Windows.Forms.SplitterEventArgs e)
    {
    // When the splitter stops moving, change the cursor back to the
 default.
    Cursor.Current=System.Windows.Forms.Cursors.Default;
    }
}
#using <System.Data.dll>
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>

using namespace System;
using namespace System::Drawing;
using namespace System::Collections;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using namespace System::Data;
public ref class Form1: public
 System::Windows::Forms::Form
{
private:
   System::Windows::Forms::SplitContainer^ splitContainer1;
   System::Windows::Forms::TreeView^ treeView1;
   System::Windows::Forms::SplitContainer^ splitContainer2;
   System::Windows::Forms::ListView^ listView2;
   System::Windows::Forms::ListView^ listView1;

public:
   Form1()
   {
      InitializeComponent();
   }


private:
   void InitializeComponent()
   {
      splitContainer1 = gcnew System::Windows::Forms::SplitContainer;
      treeView1 = gcnew System::Windows::Forms::TreeView;
      splitContainer2 = gcnew System::Windows::Forms::SplitContainer;
      listView1 = gcnew System::Windows::Forms::ListView;
      listView2 = gcnew System::Windows::Forms::ListView;
      splitContainer1->SuspendLayout();
      splitContainer2->SuspendLayout();
      SuspendLayout();
      
      // Basic SplitContainer properties.
      // This is a vertical splitter that moves in 10-pixel increments.
      // This splitter needs no explicit Orientation property because
 Vertical is the default.
      splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill;
      splitContainer1->ForeColor = System::Drawing::SystemColors::Control;
      splitContainer1->Location = System::Drawing::Point( 0, 0 );
      splitContainer1->Name = "splitContainer1";
      
      // You can drag the splitter no nearer than 30 pixels from the
 left edge of the container.
      splitContainer1->Panel1MinSize = 30;
      
      // You can drag the splitter no nearer than 20 pixels from the
 right edge of the container.
      splitContainer1->Panel2MinSize = 20;
      splitContainer1->Size = System::Drawing::Size( 292, 273 );
      splitContainer1->SplitterDistance = 79;
      
      // This splitter moves in 10-pixel increments.
      splitContainer1->SplitterIncrement = 10;
      splitContainer1->SplitterWidth = 6;
      
      // splitContainer1 is the first control in the tab order.
      splitContainer1->TabIndex = 0;
      splitContainer1->Text = "splitContainer1";
      
      // When the splitter moves, the cursor changes shape.
      splitContainer1->SplitterMoved += gcnew System::Windows::Forms::SplitterEventHandler(
 this, &Form1::splitContainer1_SplitterMoved );
      splitContainer1->SplitterMoving += gcnew System::Windows::Forms::SplitterCancelEventHandler(
 this, &Form1::splitContainer1_SplitterMoving );
      
      // Add a TreeView control to the left panel.
      splitContainer1->Panel1->BackColor = System::Drawing::SystemColors::Control;
      
      // Add a TreeView control to Panel1.
      splitContainer1->Panel1->Controls->Add( treeView1 );
      splitContainer1->Panel1->Name = "splitterPanel1";
      
      // Controls placed on Panel1 support right-to-left fonts.
      splitContainer1->Panel1->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
      
      // Add a SplitContainer to the right panel.
      splitContainer1->Panel2->Controls->Add( splitContainer2 );
      splitContainer1->Panel2->Name = "splitterPanel2";
      
      // This TreeView control is in Panel1 of splitContainer1.
      treeView1->Dock = System::Windows::Forms::DockStyle::Fill;
      treeView1->ForeColor = System::Drawing::SystemColors::InfoText;
      treeView1->ImageIndex = -1;
      treeView1->Location = System::Drawing::Point( 0, 0 );
      treeView1->Name = "treeView1";
      treeView1->SelectedImageIndex = -1;
      treeView1->Size = System::Drawing::Size( 79, 273 );
      
      // treeView1 is the second control in the tab order.
      treeView1->TabIndex = 1;
      
      // Basic SplitContainer properties.
      // This is a horizontal splitter whose top and bottom panels are
 ListView controls. The top panel is fixed.
      splitContainer2->Dock = System::Windows::Forms::DockStyle::Fill;
      
      // The top panel remains the same size when the form is resized.
      splitContainer2->FixedPanel = System::Windows::Forms::FixedPanel::Panel1;
      splitContainer2->Location = System::Drawing::Point( 0, 0 );
      splitContainer2->Name = "splitContainer2";
      
      // Create the horizontal splitter.
      splitContainer2->Orientation = System::Windows::Forms::Orientation::Horizontal;
      splitContainer2->Size = System::Drawing::Size( 207, 273 );
      splitContainer2->SplitterDistance = 125;
      splitContainer2->SplitterWidth = 6;
      
      // splitContainer2 is the third control in the tab order.
      splitContainer2->TabIndex = 2;
      splitContainer2->Text = "splitContainer2";
      
      // This splitter panel contains the top ListView control.
      splitContainer2->Panel1->Controls->Add( listView1 );
      splitContainer2->Panel1->Name = "splitterPanel3";
      
      // This splitter panel contains the bottom ListView control.
      splitContainer2->Panel2->Controls->Add( listView2 );
      splitContainer2->Panel2->Name = "splitterPanel4";
      
      // This ListView control is in the top panel of splitContainer2.
      listView1->Dock = System::Windows::Forms::DockStyle::Fill;
      listView1->Location = System::Drawing::Point( 0, 0 );
      listView1->Name = "listView1";
      listView1->Size = System::Drawing::Size( 207, 125 );
      
      // listView1 is the fourth control in the tab order.
      listView1->TabIndex = 3;
      
      // This ListView control is in the bottom panel of splitContainer2.
      listView2->Dock = System::Windows::Forms::DockStyle::Fill;
      listView2->Location = System::Drawing::Point( 0, 0 );
      listView2->Name = "listView2";
      listView2->Size = System::Drawing::Size( 207, 142 );
      
      // listView2 is the fifth control in the tab order.
      listView2->TabIndex = 4;
      
      // These are basic properties of the form.
      ClientSize = System::Drawing::Size( 292, 273 );
      Controls->Add( splitContainer1 );
      Name = "Form1";
      Text = "Form1";
      splitContainer1->ResumeLayout( false );
      splitContainer2->ResumeLayout( false );
      ResumeLayout( false );
   }

   void splitContainer1_SplitterMoving( System::Object^ /*sender*/,
 System::Windows::Forms::SplitterCancelEventArgs ^ /*e*/ )
   {
      
      // As the splitter moves, change the cursor type.
      ::Cursor::Current = System::Windows::Forms::Cursors::NoMoveVert;
   }

   void splitContainer1_SplitterMoved( System::Object^ /*sender*/,
 System::Windows::Forms::SplitterEventArgs^ /*e*/ )
   {
      
      // When the splitter stops moving, change the cursor back to the
 default.
      ::Cursor::Current = System::Windows::Forms::Cursors::Default;
   }

};


[STAThread]
int main()
{
   Application::Run( gcnew Form1 );
}

import System.*;
import System.Drawing.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;
import System.Data.*;

public class Form1 extends System.Windows.Forms.Form
{
    private System.Windows.Forms.SplitContainer splitContainer1;
    private System.Windows.Forms.TreeView treeView1;
    private System.Windows.Forms.SplitContainer splitContainer2;
    private System.Windows.Forms.ListView listView2;
    private System.Windows.Forms.ListView listView1;

    public Form1()
    {
        InitializeComponent();
    } //Form1

    private void InitializeComponent()
    {
        splitContainer1 = new System.Windows.Forms.SplitContainer();
        treeView1 = new System.Windows.Forms.TreeView();
        splitContainer2 = new System.Windows.Forms.SplitContainer();
        listView1 = new System.Windows.Forms.ListView();
        listView2 = new System.Windows.Forms.ListView();
        splitContainer1.SuspendLayout();
        splitContainer2.SuspendLayout();
        SuspendLayout();

        // Basic SplitContainer properties.
        // This is a vertical splitter that moves in 10-pixel increments.
        // This splitter needs no explicit Orientation property because
 
        // Vertical is the default.
        splitContainer1.set_Dock(System.Windows.Forms.DockStyle.Fill);
        splitContainer1.set_ForeColor(System.Drawing.SystemColors.get_Control());
        splitContainer1.set_Location(new System.Drawing.Point(0,
 0));
        splitContainer1.set_Name("splitContainer1");

        // You can drag the splitter no nearer than 30 pixels from the
 
        // left edge of the container.
        splitContainer1.set_Panel1MinSize(30);

        // You can drag the splitter no nearer than 20 pixels from the
 
        // right edge of the container.
        splitContainer1.set_Panel2MinSize(20);
        splitContainer1.set_Size(new System.Drawing.Size(292,
 273));
        splitContainer1.set_SplitterDistance(79);

        // This splitter moves in 10-pixel increments.
        splitContainer1.set_SplitterIncrement(10);
        splitContainer1.set_SplitterWidth(6);

        // splitContainer1 is the first control in the tab order.
        splitContainer1.set_TabIndex(0);
        splitContainer1.set_Text("splitContainer1");

        // When the splitter moves, the cursor changes shape.
        splitContainer1.add_SplitterMoved(new System.Windows.Forms.
            SplitterEventHandler(splitContainer1_SplitterMoved));
        splitContainer1.add_SplitterMoving(new System.Windows.Forms.
            SplitterCancelEventHandler(splitContainer1_SplitterMoving));

        // Add a TreeView control to the left panel.
        splitContainer1.get_Panel1().set_BackColor(System.Drawing.SystemColors.
            get_Control());

        // Add a TreeView control to Panel1.
        splitContainer1.get_Panel1().get_Controls().Add(treeView1);
        splitContainer1.get_Panel1().set_Name("splitterPanel1");

        // Controls placed on Panel1 support right-to-left fonts.
        splitContainer1.get_Panel1().set_RightToLeft(System.Windows.Forms.
            RightToLeft.Yes);

        // Add a SplitContainer to the right panel.
        splitContainer1.get_Panel2().get_Controls().Add(splitContainer2);
        splitContainer1.get_Panel2().set_Name("splitterPanel2");

        // This TreeView control is in Panel1 of splitContainer1.
        treeView1.set_Dock(System.Windows.Forms.DockStyle.Fill);
        treeView1.set_ForeColor(System.Drawing.SystemColors.
            get_InfoText());
        treeView1.set_ImageIndex(-1);
        treeView1.set_Location(new System.Drawing.Point(0, 0));
        treeView1.set_Name("treeView1");
        treeView1.set_SelectedImageIndex(-1);
        treeView1.set_Size(new System.Drawing.Size(79, 273));

        // treeView1 is the second control in the tab order.
        treeView1.set_TabIndex(1);

        // Basic SplitContainer properties.
        // This is a horizontal splitter whose top and bottom panels
 are 
        // ListView controls. The top panel is fixed.
        splitContainer2.set_Dock(System.Windows.Forms.DockStyle.Fill);

        // The top panel remains the same size when the form is resized.
        splitContainer2.set_FixedPanel(System.Windows.Forms.
            FixedPanel.Panel1);
        splitContainer2.set_Location(new System.Drawing.Point(0,
 0));
        splitContainer2.set_Name("splitContainer2");

        // Create the horizontal splitter.
        splitContainer2.set_Orientation(System.Windows.Forms.
            Orientation.Horizontal);
        splitContainer2.set_Size(new System.Drawing.Size(207,
 273));
        splitContainer2.set_SplitterDistance(125);
        splitContainer2.set_SplitterWidth(6);

        // splitContainer2 is the third control in the tab order.
        splitContainer2.set_TabIndex(2);
        splitContainer2.set_Text("splitContainer2");

        // This splitter panel contains the top ListView control.
        splitContainer2.get_Panel1().get_Controls().Add(listView1);
        splitContainer2.get_Panel1().set_Name("splitterPanel3");

        // This splitter panel contains the bottom ListView control.
        splitContainer2.get_Panel2().get_Controls().Add(listView2);
        splitContainer2.get_Panel2().set_Name("splitterPanel4");

        // This ListView control is in the top panel of splitContainer2.
        listView1.set_Dock(System.Windows.Forms.DockStyle.Fill);
        listView1.set_Location(new System.Drawing.Point(0, 0));
        listView1.set_Name("listView1");
        listView1.set_Size(new System.Drawing.Size(207, 125));

        // listView1 is the fourth control in the tab order.
        listView1.set_TabIndex(3);

        // This ListView control is in the bottom panel of splitContainer2.
        listView2.set_Dock(System.Windows.Forms.DockStyle.Fill);
        listView2.set_Location(new System.Drawing.Point(0, 0));
        listView2.set_Name("listView2");
        listView2.set_Size(new System.Drawing.Size(207, 142));

        // listView2 is the fifth control in the tab order.
        listView2.set_TabIndex(4);

        // These are basic properties of the form.
        set_ClientSize(new System.Drawing.Size(292, 273));
        get_Controls().Add(splitContainer1);
        set_Name("Form1");
        set_Text("Form1");
        splitContainer1.ResumeLayout(false);
        splitContainer2.ResumeLayout(false);
        ResumeLayout(false);
    } //InitializeComponent

    /** @attribute STAThread()
     */
    public static void main(String[]
 args)
    {
        Application.Run(new Form1());
    } //main

    private void splitContainer1_SplitterMoving(Object
 sender, 
        System.Windows.Forms.SplitterCancelEventArgs e)
    {
        // As the splitter moves, change the cursor type.
        get_Cursor().set_Current(System.Windows.Forms.Cursors.
            get_NoMoveVert());
    } //splitContainer1_SplitterMoving

    private void splitContainer1_SplitterMoved(Object
 sender, 
        System.Windows.Forms.SplitterEventArgs e)
    {
        // When the splitter stops moving, change the cursor 
        // back to the default.
        get_Cursor().set_Current(System.Windows.Forms.Cursors.
            get_Default());
    } //splitContainer1_SplitterMoved
} //Form1
継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
       System.Windows.Forms.Control
         System.Windows.Forms.ScrollableControl
           System.Windows.Forms.ContainerControl
            System.Windows.Forms.SplitContainer
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からSplitContainer クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からSplitContainer クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からSplitContainer クラス を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「SplitContainer クラス」の関連用語

SplitContainer クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SplitContainer クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS