Freigeben über


Splitter.MinSize-Eigenschaft

Ruft den Mindestabstand ab, der zwischen dem Splittersteuerelement und dem Containerrand verbleiben muss, an den dieses Steuerelement angedockt ist, oder legt diesen fest. Splitter.MinSize wurde ersetzt durch SplitContainer.Panel1MinSize, und SplitContainer.Panel2MinSize und wird nur bereitgestellt, um die Kompatibilität mit früheren Versionen zu gewährleisten.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
<LocalizableAttribute(True)> _
Public Property MinSize As Integer
'Usage
Dim instance As Splitter
Dim value As Integer

value = instance.MinSize

instance.MinSize = value
[LocalizableAttribute(true)] 
public int MinSize { get; set; }
[LocalizableAttribute(true)] 
public:
property int MinSize {
    int get ();
    void set (int value);
}
/** @property */
public int get_MinSize ()

/** @property */
public void set_MinSize (int value)
public function get MinSize () : int

public function set MinSize (value : int)

Eigenschaftenwert

Der Mindestabstand in Pixel zwischen dem Splitter-Steuerelement und dem Rand des Containers, an den das Steuerelement angedockt ist. Der Standardwert ist 25.

Hinweise

Für ein horizontales Splitter-Steuerelement (ein am oberen oder unteren Rand eines Containers angedocktes Splitter-Steuerelement) ist dieser Wert die Mindesthöhe des in der Größe veränderbaren Steuerelements. Für ein vertikales Splitter-Steuerelement (ein am linken oder rechten Rand eines Containers angedocktes Splitter-Steuerelement) ist dieser Wert die Mindestbreite des in der Größe veränderbare Steuerelements. Der Benutzer kann den Splitter nicht über die durch diese Eigenschaft angegebene Grenze hinaus verschieben.

Hinweis

Wenn die MinSize-Eigenschaft auf einen negativen Wert festgelegt ist, wird der Eigenschaftenwert auf 0 (null) zurückgesetzt.

Beispiel

Im folgenden Codebeispiel wird ein Splitter-Steuerelement in Verbindung mit einem TreeView-Steuerelement und einem ListView-Steuerelement verwendet, um ein dem Windows Explorer ähnliches Fenster zu erstellen. Um das TreeView-Steuerelement und das ListView-Steuerelement zu bezeichnen, werden beiden Steuerelementen Knoten und Elemente hinzugefügt. Im Beispiel werden die MinExtra-Eigenschaft und die MinSize-Eigenschaft von Splitter verwendet, um zu verhindern, dass das TreeView-Steuerelements oder das ListView-Steuerelements zu stark vergrößert oder verkleinert werden. Für dieses Beispiel ist es erforderlich, dass die im Beispiel erstellte Methode in einem Form definiert ist und die Methode über den Konstruktor des Form aufgerufen wird.

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

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0

Siehe auch

Referenz

Splitter-Klasse
Splitter-Member
System.Windows.Forms-Namespace
Splitter.MinExtra-Eigenschaft