Splitter.MinExtra 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 côté opposé du conteneur (ou le contrôle le plus proche ancré à ce côté). MinExtra a été remplacé par des propriétés similaires dans SplitContainer et n’est fourni que pour la compatibilité avec les versions précédentes.
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
Valeur de propriété
Distance minimale, en pixels, entre le Splitter contrôle et le bord du côté opposé du conteneur (ou le contrôle le plus proche ancré à ce côté). 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), la hauteur minimale de la zone du conteneur réservée aux contrôles non suspendus est cette valeur moins la hauteur du Splitter contrôle. Pour un contrôle vertical Splitter (un Splitter contrôle ancré à gauche ou à droite d’un conteneur), la largeur minimale de la zone du conteneur réservée aux contrôles non suspendus est cette valeur moins la largeur du Splitter contrôle. 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 MinExtra propriété est définie sur une valeur négative, la valeur de la propriété est réinitialisée à 0.