Compartir vía


ToolStripDropDownItem Constructores

Definición

Inicializa una nueva instancia de la clase ToolStripDropDownItem.

Sobrecargas

ToolStripDropDownItem()

Inicializa una nueva instancia de la clase ToolStripDropDownItem.

ToolStripDropDownItem(String, Image, EventHandler)

Inicializa una nueva instancia de la clase ToolStripDropDownItem con el texto para mostrar y la imagen especificados, y la acción que se realizará cuando se haga clic en el control desplegable.

ToolStripDropDownItem(String, Image, ToolStripItem[])

Inicializa una nueva instancia de la clase ToolStripDropDownItem con el texto para mostrar y la imagen especificados, y la colección ToolStripItem que contiene el control desplegable.

ToolStripDropDownItem(String, Image, EventHandler, String)

Inicializa una nueva instancia de la clase ToolStripDropDownItem con el texto para mostrar y la imagen especificados, la acción que se realizará cuando se haga clic en el control desplegable y el nombre del control.

Comentarios

Debe derivar un control desplegable de la ToolStripDropDownItem clase para tener cualquier funcionalidad desplegable para un ToolStripDropDownButtoncontrol , ToolStripMenuItemo ToolStripSplitButton .

ToolStripDropDownItem()

Inicializa una nueva instancia de la clase ToolStripDropDownItem.

protected:
 ToolStripDropDownItem();
protected ToolStripDropDownItem ();
Protected Sub New ()

Ejemplos

En el ejemplo de código siguiente se muestra cómo crear e inicializar ToolStripDropDownItem controles. Este ejemplo de código forma parte de un ejemplo más grande proporcionado para la ToolStripDropDownItem clase .

// This utility method creates and initializes three 
// ToolStripDropDownItem controls and adds them 
// to the form's ToolStrip control.
private void InitializeToolStripDropDownItems()
{
    ToolStripDropDownButton b = new ToolStripDropDownButton("DropDownButton");
    b.DropDown = this.contextMenuStrip1;
    b.DropDownClosed += new EventHandler(toolStripDropDownItem_DropDownClosed);
    b.DropDownItemClicked += new ToolStripItemClickedEventHandler(toolStripDropDownItem_DropDownItemClicked);
    b.DropDownOpened += new EventHandler(toolStripDropDownItem_DropDownOpened);

    ToolStripMenuItem m = new ToolStripMenuItem("MenuItem");
    m.DropDown = this.contextMenuStrip1;
    m.DropDownClosed += new EventHandler(toolStripDropDownItem_DropDownClosed);
    m.DropDownItemClicked += new ToolStripItemClickedEventHandler(toolStripDropDownItem_DropDownItemClicked);
    m.DropDownOpened += new EventHandler(toolStripDropDownItem_DropDownOpened);

    ToolStripSplitButton sb = new ToolStripSplitButton("SplitButton");
    sb.DropDown = this.contextMenuStrip1;
    sb.DropDownClosed += new EventHandler(toolStripDropDownItem_DropDownClosed);
    sb.DropDownItemClicked += new ToolStripItemClickedEventHandler(toolStripDropDownItem_DropDownItemClicked);
    sb.DropDownOpened += new EventHandler(toolStripDropDownItem_DropDownOpened);

    this.toolStrip1.Items.AddRange(new ToolStripItem[] { b, m, sb });
}
' This utility method creates and initializes three 
' ToolStripDropDownItem controls and adds them 
' to the form's ToolStrip control.
Private Sub InitializeToolStripDropDownItems()
   Dim b As New ToolStripDropDownButton("DropDownButton")
   b.DropDown = Me.contextMenuStrip1
   AddHandler b.DropDownClosed, AddressOf toolStripDropDownItem_DropDownClosed
   AddHandler b.DropDownItemClicked, AddressOf toolStripDropDownItem_DropDownItemClicked
   AddHandler b.DropDownOpened, AddressOf toolStripDropDownItem_DropDownOpened
   
   Dim m As New ToolStripMenuItem("MenuItem")
   m.DropDown = Me.contextMenuStrip1
   AddHandler m.DropDownClosed, AddressOf toolStripDropDownItem_DropDownClosed
   AddHandler m.DropDownItemClicked, AddressOf toolStripDropDownItem_DropDownItemClicked
   AddHandler m.DropDownOpened, AddressOf toolStripDropDownItem_DropDownOpened
   
   Dim sb As New ToolStripSplitButton("SplitButton")
   sb.DropDown = Me.contextMenuStrip1
   AddHandler sb.DropDownClosed, AddressOf toolStripDropDownItem_DropDownClosed
   AddHandler sb.DropDownItemClicked, AddressOf toolStripDropDownItem_DropDownItemClicked
   AddHandler sb.DropDownOpened, AddressOf toolStripDropDownItem_DropDownOpened
   
   Me.toolStrip1.Items.AddRange(New ToolStripItem() {b, m, sb})
End Sub

Comentarios

Debe derivar un control desplegable de la ToolStripDropDownItem clase para tener cualquier funcionalidad desplegable para un ToolStripDropDownButtoncontrol , ToolStripMenuItemo ToolStripSplitButton .

Se aplica a

ToolStripDropDownItem(String, Image, EventHandler)

Inicializa una nueva instancia de la clase ToolStripDropDownItem con el texto para mostrar y la imagen especificados, y la acción que se realizará cuando se haga clic en el control desplegable.

protected:
 ToolStripDropDownItem(System::String ^ text, System::Drawing::Image ^ image, EventHandler ^ onClick);
protected ToolStripDropDownItem (string text, System.Drawing.Image image, EventHandler onClick);
new System.Windows.Forms.ToolStripDropDownItem : string * System.Drawing.Image * EventHandler -> System.Windows.Forms.ToolStripDropDownItem
Protected Sub New (text As String, image As Image, onClick As EventHandler)

Parámetros

text
String

Texto para mostrar del control desplegable.

image
Image

El objeto Image que se va a mostrar en el control.

onClick
EventHandler

Acción a realizar cuando se haga clic en el control desplegable.

Comentarios

Debe derivar un control desplegable de la ToolStripDropDownItem clase para tener cualquier funcionalidad desplegable para un ToolStripDropDownButtoncontrol , ToolStripMenuItemo ToolStripSplitButton .

Se aplica a

ToolStripDropDownItem(String, Image, ToolStripItem[])

Inicializa una nueva instancia de la clase ToolStripDropDownItem con el texto para mostrar y la imagen especificados, y la colección ToolStripItem que contiene el control desplegable.

protected:
 ToolStripDropDownItem(System::String ^ text, System::Drawing::Image ^ image, ... cli::array <System::Windows::Forms::ToolStripItem ^> ^ dropDownItems);
protected ToolStripDropDownItem (string text, System.Drawing.Image image, params System.Windows.Forms.ToolStripItem[] dropDownItems);
new System.Windows.Forms.ToolStripDropDownItem : string * System.Drawing.Image * System.Windows.Forms.ToolStripItem[] -> System.Windows.Forms.ToolStripDropDownItem
Protected Sub New (text As String, image As Image, ParamArray dropDownItems As ToolStripItem())

Parámetros

text
String

Texto para mostrar del control desplegable.

image
Image

El objeto Image que se va a mostrar en el control.

dropDownItems
ToolStripItem[]

Una colección ToolStripItem que contiene el control desplegable.

Comentarios

Debe derivar un control desplegable de la ToolStripDropDownItem clase para tener cualquier funcionalidad desplegable para un ToolStripDropDownButtoncontrol , ToolStripMenuItemo ToolStripSplitButton .

Se aplica a

ToolStripDropDownItem(String, Image, EventHandler, String)

Inicializa una nueva instancia de la clase ToolStripDropDownItem con el texto para mostrar y la imagen especificados, la acción que se realizará cuando se haga clic en el control desplegable y el nombre del control.

protected:
 ToolStripDropDownItem(System::String ^ text, System::Drawing::Image ^ image, EventHandler ^ onClick, System::String ^ name);
protected ToolStripDropDownItem (string text, System.Drawing.Image image, EventHandler onClick, string name);
new System.Windows.Forms.ToolStripDropDownItem : string * System.Drawing.Image * EventHandler * string -> System.Windows.Forms.ToolStripDropDownItem
Protected Sub New (text As String, image As Image, onClick As EventHandler, name As String)

Parámetros

text
String

Texto para mostrar del control desplegable.

image
Image

El objeto Image que se va a mostrar en el control.

onClick
EventHandler

Acción a realizar cuando se haga clic en el control desplegable.

name
String

Nombre del control.

Se aplica a