Splitter.MinExtra プロパティ

定義

分割コントロールとコンテナー (またはその側にドッキングされている最も近接しているコントロール) の反対側の端との間に必要な最小距離を取得または設定します。 MinExtra の代わりに SplitContainer の同様のプロパティが採用されているため、これは以前のバージョンと互換性を維持するためだけに残されています。

public:
 property int MinExtra { int get(); void set(int value); };
public int MinExtra { get; set; }
member this.MinExtra : int with get, set
Public Property MinExtra As Integer

プロパティ値

Splitter コントロールとコンテナー (またはその側にドッキングされている最も近接しているコントロール) の反対側の端との間の最小距離 (ピクセル単位)。 既定値は 25 です。

次のコード例では、 コントロールと コントロールListViewSplitter組み合わせてTreeView使用して、Windows エクスプローラーのようなウィンドウを作成します。 コントロールと ListView コントロールをTreeView識別するために、ノードと項目が両方のコントロールに追加されます。 この例では、 MinExtraSplitter プロパティと MinSize プロパティを使用して、 コントロールまたは ListView コントロールのTreeViewサイズが小さすぎたり大きすぎたりするのを防ぎます。 この例では、この例で作成したメソッドが 内で Form 定義され、 のコンストラクター 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

注釈

水平 Splitter コントロール ( Splitter コンテナーの上部または下部にドッキングされたコントロール) の場合、ドッキングされていないコントロール用に予約されているコンテナーの領域の最小高さは、この値からコントロールの Splitter 高さを引いた値です。 垂直 Splitter コントロール ( Splitter コンテナーの左または右にドッキングされたコントロール) の場合、ドッキングされていないコントロール用に予約されているコンテナーの領域の最小幅は、この値からコントロールの幅を Splitter 引いた値です。 ユーザーは、このプロパティで指定された制限を超えてスプリッターを移動できません。

注意

プロパティが負の MinExtra 値に設定されている場合、プロパティ値は 0 にリセットされます。

適用対象

こちらもご覧ください