Splitter.MinSize Vlastnost

Definice

Získá nebo nastaví minimální vzdálenost, která musí zůstat mezi rozdělovačem a okrajem kontejneru, ke kterému je ovládací prvek ukotven. MinSize byla nahrazena Panel1MinSize a Panel2MinSize je poskytována pouze z důvodu kompatibility s předchozími verzemi.

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

Hodnota vlastnosti

Int32

Minimální vzdálenost v pixelech mezi Splitter ovládacím prvku a okrajem kontejneru, ke kterému je ovládací prvek ukotven. Výchozí hodnota je 25.

Příklady

Následující příklad kódu používá Splitter ovládací prvek v kombinaci s TreeView ovládacími ListView prvky k vytvoření okna podobnému Windows Exploreru. K identifikaci ovládacích TreeView prvků a ListView ovládacích prvků se uzly a položky přidají do obou ovládacích prvků. V příkladu Splitter se MinExtra používají vlastnosti a MinSize vlastnosti, které brání TreeView velikosti nebo ListView ovládacího prvku v příliš malé nebo příliš velké velikosti. Tento příklad vyžaduje, aby metoda vytvořená v tomto příkladu byla definována v rámci Form a že metoda je volána z konstruktoru 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

Poznámky

U vodorovného Splitter ovládacího prvku ( Splitter ovládací prvek ukotvený k horní nebo dolní části kontejneru) je tato hodnota minimální výška ovládacího prvku umožňující změnu velikosti. U svislého Splitter ovládacího prvku ( Splitter ovládací prvek ukotvený nalevo nebo vpravo od kontejneru) je tato hodnota minimální šířka ovládacího prvku umožňující změnu velikosti. Uživatel nemůže přesunout rozdělovač za limit určený touto vlastností.

Poznámka

MinSize Pokud je vlastnost nastavena na zápornou hodnotu, hodnota vlastnosti se resetuje na 0.

Platí pro

Viz také