分割コントロールとコンテナ (またはその側にドッキングされている最も近接しているコントロール) の反対側の端との間に残す必要のある最小距離を取得または設定します。
Public Property MinExtra As Integer
[C#]
public int MinExtra {get; set;}
[C++]
public: __property int get_MinExtra();public: __property void set_MinExtra(int);
[JScript]
public function get MinExtra() : int;public function set MinExtra(int);
プロパティ値
Splitter コントロールとコンテナ (またはその側にドッキングされている最も近接しているコントロール) の反対側の端との間の最小距離 (ピクセル単位)。既定値は 25 です。
解説
水平方向の Splitter コントロール (コンテナの上下にドッキングされる Splitter コントロール) の場合、ドッキングされていないコントロールのために予約済みのコンテナ領域の最小の高さは、この値から Splitter コントロールの高さを引いた値になります。垂直方向の Splitter コントロール (コンテナの左右にドッキングされる Splitter コントロール) の場合、ドッキングされていないコントロールのために予約済みのコンテナ領域の最小の幅は、この値から Splitter コントロールの幅を引いた値になります。ユーザーは、このプロパティで指定された上限を超えて分割コントロールを移動できません。
メモ MinExtra プロパティを負の値に設定すると、プロパティ値は 0 にリセットされます。
使用例
[Visual Basic, C#, C++] 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
[C#]
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});
}
[C++]
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(S"TreeView Node");
listView1->Items->Add(S"ListView Item");
// Add the controls in reverse order to the form to ensure proper ___location.
Control* temp0 [] = {listView1, splitter1, treeView1};
this->Controls->AddRange(temp0);
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
Splitter クラス | Splitter メンバ | System.Windows.Forms 名前空間 | MinSize