Splitter.MinSize Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee wordt de minimale afstand opgehaald of ingesteld die moet blijven tussen het splitter-besturingselement en de containerrand waarop het besturingselement is gedokt. MinSize is vervangen door Panel1MinSize en Panel2MinSize is alleen beschikbaar voor compatibiliteit met eerdere versies.
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
Waarde van eigenschap
De minimale afstand, in pixels, tussen het Splitter besturingselement en de containerrand waaraan het besturingselement is gekoppeld. De standaardwaarde is 25.
Voorbeelden
In het volgende codevoorbeeld wordt een besturingselement Splitter gebruikt in combinatie met TreeView en ListView-besturingselementen om een venster te maken dat vergelijkbaar is met Windows Explorer. Om de TreeView en ListView besturingselementen te identificeren, worden knooppunten en items toegevoegd aan beide besturingselementen. In het voorbeeld worden de MinExtra eigenschappen en MinSize eigenschappen gebruikt Splitter om te voorkomen dat de grootte van het TreeView besturingselement ListView te klein of te groot is. Voor dit voorbeeld is vereist dat de methode die in dit voorbeeld is gemaakt, wordt gedefinieerd in een Form en dat de methode wordt aangeroepen vanuit de constructor van de 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
Opmerkingen
Voor een horizontaal Splitter besturingselement (een Splitter besturingselement dat is gekoppeld aan de boven- of onderkant van een container), is deze waarde de minimale hoogte van het besturingselement dat kan worden aangepast. Voor een verticaal Splitter besturingselement (een Splitter besturingselement dat links of rechts van een container is gedokt), is deze waarde de minimale breedte van het besturingselement dat kan worden aangepast. De gebruiker kan de splitser niet voorbij de limiet verplaatsen die is opgegeven door deze eigenschap.
Note
Als de MinSize eigenschap is ingesteld op een negatieve waarde, wordt de eigenschapswaarde opnieuw ingesteld op 0.