Assembly : System.Windows.Forms (dans system.windows.forms.dll)
Syntaxe<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ <ComVisibleAttribute(True)> _ Public Class Panel Inherits ScrollableControl
Dim instance As Panel
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] [ComVisibleAttribute(true)] public class Panel : ScrollableControl
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] [ComVisibleAttribute(true)] public ref class Panel : public ScrollableControl
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ /** @attribute ComVisibleAttribute(true) */ public class Panel extends ScrollableControl
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) ComVisibleAttribute(true) public class Panel extends ScrollableControl
NotesPanel est un contrôle qui contient d'autres contrôles. Vous pouvez utiliser un Panel pour regrouper des collections de contrôles telles qu'un groupe de contrôles RadioButton. Comme pour d'autres contrôles conteneur tels que le contrôle GroupBox, si la propriété Enabled du contrôle Panel a la valeur false, les contrôles contenus dans Panel seront également désactivés.
Par défaut, le contrôle Panel est affiché sans bordure. Vous pouvez fournir une bordure standard ou en trois dimensions à l'aide de la propriété BorderStyle afin de distinguer la zone du volet des autres zones du formulaire. Dans la mesure où le contrôle Panel dérive de la classe ScrollableControl, vous pouvez utiliser la propriété AutoScroll pour activer les barres de défilement dans le contrôle Panel. Lorsque la propriété AutoScroll a la valeur true, tous les contrôles situés dans Panel (à l'extérieur de sa zone visible), peuvent faire l'objet d'un défilement en présence des barres de défilement.
Le contrôle Panel n'affiche pas de légende. Si vous avez besoin d'un contrôle semblable à Panel qui peut afficher une légende, consultez le contrôle GroupBox.
ExempleL'exemple de code suivant crée un contrôle Panel, puis ajoute une Label et une TextBox au Panel. Le contrôle Panel est affiché avec une bordure en trois dimensions pour distinguer l'emplacement du contrôle Panel par rapport à d'autres objets du formulaire. Cet exemple suppose que la méthode définie dans cet exemple est appelée à partir d'un formulaire existant et que l'espace de noms System.Drawing a été ajouté au code source pour le formulaire.
Public Sub CreateMyPanel() Dim panel1 As New Panel() Dim textBox1 As New TextBox() Dim label1 As New Label() ' Initialize the Panel control. panel1.Location = New Point(56, 72) panel1.Size = New Size(264, 152) ' Set the Borderstyle for the Panel to three-dimensional. panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D ' Initialize the Label and TextBox controls. label1.Location = New Point(16, 16) label1.Text = "label1" label1.Size = New Size(104, 16) textBox1.Location = New Point(16, 32) textBox1.Text = "" textBox1.Size = New Size(152, 20) ' Add the Panel control to the form. Me.Controls.Add(panel1) ' Add the Label and TextBox controls to the Panel. panel1.Controls.Add(label1) panel1.Controls.Add(textBox1) End Sub
public void CreateMyPanel() { Panel panel1 = new Panel(); TextBox textBox1 = new TextBox(); Label label1 = new Label(); // Initialize the Panel control. panel1.Location = new Point(56,72); panel1.Size = new Size(264, 152); // Set the Borderstyle for the Panel to three-dimensional. panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; // Initialize the Label and TextBox controls. label1.Location = new Point(16,16); label1.Text = "label1"; label1.Size = new Size(104, 16); textBox1.Location = new Point(16,32); textBox1.Text = ""; textBox1.Size = new Size(152, 20); // Add the Panel control to the form. this.Controls.Add(panel1); // Add the Label and TextBox controls to the Panel. panel1.Controls.Add(label1); panel1.Controls.Add(textBox1); }
public: void CreateMyPanel() { Panel^ panel1 = gcnew Panel; TextBox^ textBox1 = gcnew TextBox; Label^ label1 = gcnew Label; // Initialize the Panel control. panel1->Location = System::Drawing::Point( 56, 72 ); panel1->Size = System::Drawing::Size( 264, 152 ); // Set the Borderstyle for the Panel to three-dimensional. panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; // Initialize the Label and TextBox controls. label1->Location = System::Drawing::Point( 16, 16 ); label1->Text = "label1"; label1->Size = System::Drawing::Size( 104, 16 ); textBox1->Location = System::Drawing::Point( 16, 32 ); textBox1->Text = ""; textBox1->Size = System::Drawing::Size( 152, 20 ); // Add the Panel control to the form. this->Controls->Add( panel1 ); // Add the Label and TextBox controls to the Panel. panel1->Controls->Add( label1 ); panel1->Controls->Add( textBox1 ); }
public void CreateMyPanel() { Panel panel1 = new Panel(); TextBox textBox1 = new TextBox(); Label label1 = new Label(); // Initialize the Panel control. panel1.set_Location(new Point(56, 72)); panel1.set_Size(new Size(264, 152)); // Set the Borderstyle for the Panel to three-dimensional. panel1.set_BorderStyle(System.Windows.Forms.BorderStyle.Fixed3D); // Initialize the Label and TextBox controls. label1.set_Location(new Point(16, 16)); label1.set_Text("label1"); label1.set_Size(new Size(104, 16)); textBox1.set_Location(new Point(16, 32)); textBox1.set_Text(""); textBox1.set_Size(new Size(152, 20)); // Add the Panel control to the form. this.get_Controls().Add(panel1); // Add the Label and TextBox controls to the Panel. panel1.get_Controls().Add(label1); panel1.get_Controls().Add(textBox1); } //CreateMyPanel
Sécurité des threads
Plates-formesWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile pour Pocket PC, Windows Mobile pour Smartphone, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition
Le .NET Framework ne prend pas en charge toutes les versions de chaque plate-forme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise.
Informations de version
Outils (masquer)
S'enregistrer
Liste des Membres
Qui est en ligne?
FAQ