Splitter.MinSize プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Splitter コントロールと、そのコントロールがドッキングされているコンテナの端との間の最小距離 (ピクセル単位)。既定値は 25 です。

水平方向の Splitter コントロール (コンテナの上下にドッキングされる Splitter コントロール) の場合、この値はサイズを変更できるコントロールの最小の高さになります。垂直方向の Splitter コントロール (コンテナの左右にドッキングされる Splitter コントロール) の場合、この値はサイズを変更できるコントロールの最小の幅になります。ユーザーは、このプロパティで指定された上限を超えて分割コントロールを移動できません。
![]() |
---|

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- Splitter.MinSize プロパティのページへのリンク