Splitter.MinSize Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient ou définit la distance minimale qui doit rester entre le contrôle de fractionnement et le bord du conteneur auquel le contrôle est ancré. MinSize a été remplacé par Panel1MinSize et Panel2MinSize n’est fourni que pour la compatibilité avec les versions précédentes.
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
Valeur de propriété
Distance minimale, en pixels, entre le Splitter contrôle et le bord du conteneur auquel le contrôle est ancré. La valeur par défaut est 25.
Exemples
L’exemple de code suivant utilise un Splitter contrôle en combinaison avec et ListView des TreeView contrôles pour créer une fenêtre similaire à l’Explorateur Windows. Pour identifier les contrôles et ListView les TreeView nœuds, les nœuds et les éléments sont ajoutés aux deux contrôles. L’exemple utilise les propriétés et les MinExtra propriétés de l’élément Splitter pour empêcher la taille ou ListView le TreeView contrôle d’être trop petit ou trop MinSize grand. Cet exemple nécessite que la méthode créée dans cet exemple soit définie dans un Form et que la méthode est appelée à partir du constructeur du 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
Remarques
Pour un contrôle horizontal Splitter (un Splitter contrôle ancré en haut ou en bas d’un conteneur), cette valeur est la hauteur minimale du contrôle redimensionnable. Pour un contrôle vertical Splitter (contrôle Splitter ancré à gauche ou à droite d’un conteneur), cette valeur est la largeur minimale du contrôle redimensionnable. L’utilisateur ne peut pas déplacer le séparateur au-delà de la limite spécifiée par cette propriété.
Note
Si la MinSize propriété est définie sur une valeur négative, la valeur de la propriété est réinitialisée à 0.