Splitter クラスの新しいインスタンスを初期化します。Splitter の代わりに SplitContainer が採用されているため、これは以前のバージョンと互換性を維持するためだけに用意されています。
名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文
'宣言
Public Sub New
'使用
Dim instance As New Splitter
public Splitter ()
public:
Splitter ()
public Splitter ()
public function Splitter ()
解説
既定では、MinSize プロパティおよび MinExtra プロパティが 25 に設定されています。Dock プロパティは、既定では DockStyle.Left に設定されています。
使用例
Splitter コントロールを TreeView コントロールおよび ListView コントロールと組み合わせて使用し、Windows エクスプローラに類似したウィンドウを作成するコード例を次に示します。TreeView コントロールおよび ListView コントロールを識別するには、ノードと項目を両方のコントロールに追加します。この例では、Splitter の MinExtra プロパティおよび MinSize プロパティを使用して、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
プラットフォーム
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