Assembly : System.Windows.Forms (dans system.windows.forms.dll)
Syntaxe<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ <ComVisibleAttribute(True)> _ Public Class ToolStrip Inherits ScrollableControl Implements IComponent, IDisposable
Dim instance As ToolStrip
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] [ComVisibleAttribute(true)] public class ToolStrip : ScrollableControl, IComponent, IDisposable
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] [ComVisibleAttribute(true)] public ref class ToolStrip : public ScrollableControl, IComponent, IDisposable
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ /** @attribute ComVisibleAttribute(true) */ public class ToolStrip extends ScrollableControl implements IComponent, IDisposable
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) ComVisibleAttribute(true) public class ToolStrip extends ScrollableControl implements IComponent, IDisposable
NotesUtilisez ToolStrip et ses classes associées dans les nouvelles applications Windows Forms pour créer des barres d'outils qui peuvent avoir une apparence et un comportement Windows XP, Office, Internet Explorer ou personnalisés, avec ou sans thèmes, avec prise en charge du dépassement de capacité et de la réorganisation des éléments au moment de l'exécution. Les contrôles ToolStrip facilitent la conception notamment grâce à l'activation et à la modification sur place, à la disposition personnalisée et au partage de l'espace horizontal ou vertical dans un ToolStripContainer spécifié.
ToolStrip est le conteneur des objets ToolStripButton, ToolStripComboBox, ToolStripSplitButton, ToolStripLabel, ToolStripSeparator, ToolStripDropDownButton, ToolStripProgressBar, ToolStripTextBox.
Pendant que la classe ToolStrip fournit de nombreux membres qui gèrent la peinture, l'entrée au clavier et de la souris et la fonctionnalité de glisser-déplacer, vous pouvez utiliser la classe ToolStripManager pour joindre des contrôles ToolStrip dans un ToolStripContainer spécifié et fusionner des contrôles ToolStrip les uns avec les autres. Utilisez la classe ToolStripRenderer avec la classe ToolStripManager pour mieux contrôler et personnaliser la peinture et le style de disposition.
Utilisez la classe ToolStripControlHost pour héberger tout autre contrôle Windows Forms dans ToolStrip.
Bien que ToolStrip remplace et ajoute des fonctionnalités au contrôle ToolBar des versions antérieures, ToolBar est conservé pour la compatibilité descendante et l'utilisation future si tel est votre choix.
ExempleL'exemple de code suivant illustre l'ajout d'un ToolStripContainer et d'un ToolStrip à un Windows Forms, l'ajout d'éléments au ToolStrip et l'ajout du ToolStrip au TopToolStripPanel du ToolStripContainer.
Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Text Imports System.Windows.Forms Public Class Form1 Inherits Form Private toolStripContainer1 As ToolStripContainer Private toolStrip1 As ToolStrip Public Sub New() InitializeComponent() End Sub 'New <STAThread()> _ Shared Sub Main() Application.EnableVisualStyles() Application.Run(New Form1()) End Sub 'Main Private Sub InitializeComponent() toolStripContainer1 = New System.Windows.Forms.ToolStripContainer() toolStrip1 = New System.Windows.Forms.ToolStrip() ' Add items to the ToolStrip. toolStrip1.Items.Add("One") toolStrip1.Items.Add("Two") toolStrip1.Items.Add("Three") ' Add the ToolStrip to the top panel of the ToolStripContainer. toolStripContainer1.TopToolStripPanel.Controls.Add(toolStrip1) ' Add the ToolStripContainer to the form. Controls.Add(toolStripContainer1) End Sub 'InitializeComponent End Class 'Form1
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; public class Form1 : Form { private ToolStripContainer toolStripContainer1; private ToolStrip toolStrip1; public Form1() { InitializeComponent(); } [STAThread] static void Main() { Application.EnableVisualStyles(); Application.Run(new Form1()); } private void InitializeComponent() { toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); toolStrip1 = new System.Windows.Forms.ToolStrip(); // Add items to the ToolStrip. toolStrip1.Items.Add("One"); toolStrip1.Items.Add("Two"); toolStrip1.Items.Add("Three"); // Add the ToolStrip to the top panel of the ToolStripContainer. toolStripContainer1.TopToolStripPanel.Controls.Add(toolStrip1); // Add the ToolStripContainer to the form. Controls.Add(toolStripContainer1); } }
Hiérarchie d'héritageSystem.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ScrollableControl
System.Windows.Forms.ToolStrip
System.Windows.Forms.BindingNavigator
System.Windows.Forms.MenuStrip
System.Windows.Forms.StatusStrip
System.Windows.Forms.ToolStripDropDown
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.
Outils (masquer)
S'enregistrer
Liste des Membres
Qui est en ligne?
FAQ