ToolStripDropDownItem.DropDown ToolStripDropDownItem.DropDown ToolStripDropDownItem.DropDown ToolStripDropDownItem.DropDown Property

定義

この ToolStripDropDown がクリックされたときに表示される ToolStripDropDownItem を取得または設定します。Gets or sets the ToolStripDropDown that will be displayed when this ToolStripDropDownItem is clicked.

public:
 property System::Windows::Forms::ToolStripDropDown ^ DropDown { System::Windows::Forms::ToolStripDropDown ^ get(); void set(System::Windows::Forms::ToolStripDropDown ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ReferenceConverter))]
public System.Windows.Forms.ToolStripDropDown DropDown { get; set; }
member this.DropDown : System.Windows.Forms.ToolStripDropDown with get, set
Public Property DropDown As ToolStripDropDown

プロパティ値

コントロールをContextMenuStrip ToolStripDropDownItemコントロールのDropDownプロパティに割り当てる方法を次のコード例に示します。The following code example demonstrates how to assign a ContextMenuStrip control to a ToolStripDropDownItem control's DropDown property. このコード例は、 ToolStripDropDownItemクラスに対して提供される大規模な例の一部です。This code example is part of a larger example provided for the ToolStripDropDownItem class.

// 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 

注釈

がに関連付けられToolStripDropDownItemている場合、 CreateDefaultDropDownを呼び出すと、ジェネリックドロップダウンコントロールが作成されます。 ToolStripDropDownIf no ToolStripDropDown is associated with the ToolStripDropDownItem, a call to CreateDefaultDropDown creates a generic drop-down control.

注意

ドロップダウンコントロールが自動的に生成された場合 (項目がコレクションに追加された場合)、 DropDownプロパティを明示的なドロップダウンコントロールに設定すると、データが失われる可能性があります。If a drop-down control is automatically generated, which means that items are added to the collection, and you then set the DropDown property to an explicit drop-down control, you might lose data.

適用対象