다음을 통해 공유


ToolStripDropDownItem.DropDown 속성

정의

ToolStripDropDown을 클릭할 때 표시되는 ToolStripDropDownItem을 가져오거나 설정합니다.

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; }
[<System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ReferenceConverter))>]
member this.DropDown : System.Windows.Forms.ToolStripDropDown with get, set
Public Property DropDown As ToolStripDropDown

속성 값

ToolStripDropDown

ToolStripDropDown와 연결된 ToolStripDropDownItem입니다.

특성

예제

다음 코드 예제에서는 컨트롤의 DropDown 속성에 컨트롤을 ContextMenuStrip ToolStripDropDownItem 할당 하는 방법을 보여 줍니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 ToolStripDropDownItem 클래스입니다.

// 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값이 없 ToolStripDropDown 으면 제네릭 드롭다운 컨트롤을 CreateDefaultDropDown 만드는 호출입니다.

참고

드롭다운 컨트롤이 자동으로 생성되어 항목이 컬렉션에 추가된 다음 속성을 명시적 드롭다운 컨트롤로 설정 DropDown 하면 데이터가 손실될 수 있습니다.

적용 대상