Aracılığıyla paylaş


ToolStripDropDownItem.DropDownItems Özellik

Tanım

içindeki bu ToolStripDropDownItemile ilişkili öğe ToolStripDropDown koleksiyonunu alır.

public:
 property System::Windows::Forms::ToolStripItemCollection ^ DropDownItems { System::Windows::Forms::ToolStripItemCollection ^ get(); };
public System.Windows.Forms.ToolStripItemCollection DropDownItems { get; }
member this.DropDownItems : System.Windows.Forms.ToolStripItemCollection
Public ReadOnly Property DropDownItems As ToolStripItemCollection

Özellik Değeri

ToolStripItemCollection

Denetimlerden ToolStripItemCollection biri.

Örnekler

Aşağıdaki kod örneği, alt menüler içeren bir menü oluşturmak için özelliğinin nasıl kullanılacağını DropDownItems gösterir. Kod örneğinin tamamı için bkz . Nasıl yapılır: MenuStrip'te Seçenek Düğmelerini Görüntüleme.

public class Form1 : Form
{
    private MenuStrip menuStrip1 = new MenuStrip();
    private ToolStripMenuItem mainToolStripMenuItem = new ToolStripMenuItem();
    private ToolStripMenuItem toolStripMenuItem1 = new ToolStripMenuItem();
    private ToolStripRadioButtonMenuItem toolStripRadioButtonMenuItem1 = 
        new ToolStripRadioButtonMenuItem();
    private ToolStripRadioButtonMenuItem toolStripRadioButtonMenuItem2 = 
        new ToolStripRadioButtonMenuItem();
    private ToolStripRadioButtonMenuItem toolStripRadioButtonMenuItem3 = 
        new ToolStripRadioButtonMenuItem();
    private ToolStripRadioButtonMenuItem toolStripRadioButtonMenuItem4 = 
        new ToolStripRadioButtonMenuItem();
    private ToolStripRadioButtonMenuItem toolStripRadioButtonMenuItem5 = 
        new ToolStripRadioButtonMenuItem();
    private ToolStripRadioButtonMenuItem toolStripRadioButtonMenuItem6 = 
        new ToolStripRadioButtonMenuItem();

    public Form1()
    {
        mainToolStripMenuItem.Text = "main";
        toolStripRadioButtonMenuItem1.Text = "option 1";
        toolStripRadioButtonMenuItem2.Text = "option 2";
        toolStripRadioButtonMenuItem3.Text = "option 2-1";
        toolStripRadioButtonMenuItem4.Text = "option 2-2";
        toolStripRadioButtonMenuItem5.Text = "option 3-1";
        toolStripRadioButtonMenuItem6.Text = "option 3-2";
        toolStripMenuItem1.Text = "toggle";
        toolStripMenuItem1.CheckOnClick = true;

        mainToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] {
            toolStripRadioButtonMenuItem1, toolStripRadioButtonMenuItem2,
            toolStripMenuItem1});
        toolStripRadioButtonMenuItem2.DropDownItems.AddRange(
            new ToolStripItem[] {toolStripRadioButtonMenuItem3, 
            toolStripRadioButtonMenuItem4});
        toolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] {
            toolStripRadioButtonMenuItem5, toolStripRadioButtonMenuItem6});

        menuStrip1.Items.AddRange(new ToolStripItem[] {mainToolStripMenuItem});
        Controls.Add(menuStrip1);
        MainMenuStrip = menuStrip1;
        Text = "ToolStripRadioButtonMenuItem demo";
    }
}

static class Program
{
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }
}
Public Class Form1
    Inherits Form

    Private menuStrip1 As New MenuStrip()
    Private mainToolStripMenuItem As New ToolStripMenuItem()
    Private toolStripMenuItem1 As New ToolStripMenuItem()
    Private toolStripRadioButtonMenuItem1 As New ToolStripRadioButtonMenuItem()
    Private toolStripRadioButtonMenuItem2 As New ToolStripRadioButtonMenuItem()
    Private toolStripRadioButtonMenuItem3 As New ToolStripRadioButtonMenuItem()
    Private toolStripRadioButtonMenuItem4 As New ToolStripRadioButtonMenuItem()
    Private toolStripRadioButtonMenuItem5 As New ToolStripRadioButtonMenuItem()
    Private toolStripRadioButtonMenuItem6 As New ToolStripRadioButtonMenuItem()

    Public Sub New()

        Me.mainToolStripMenuItem.Text = "main"
        toolStripRadioButtonMenuItem1.Text = "option 1"
        toolStripRadioButtonMenuItem2.Text = "option 2"
        toolStripRadioButtonMenuItem3.Text = "option 2-1"
        toolStripRadioButtonMenuItem4.Text = "option 2-2"
        toolStripRadioButtonMenuItem5.Text = "option 3-1"
        toolStripRadioButtonMenuItem6.Text = "option 3-2"
        toolStripMenuItem1.Text = "toggle"
        toolStripMenuItem1.CheckOnClick = True

        mainToolStripMenuItem.DropDownItems.AddRange(New ToolStripItem() { _
            toolStripRadioButtonMenuItem1, toolStripRadioButtonMenuItem2, _
            toolStripMenuItem1})
        toolStripRadioButtonMenuItem2.DropDownItems.AddRange( _
            New ToolStripItem() {toolStripRadioButtonMenuItem3, _
            toolStripRadioButtonMenuItem4})
        toolStripMenuItem1.DropDownItems.AddRange(New ToolStripItem() { _
            toolStripRadioButtonMenuItem5, toolStripRadioButtonMenuItem6})

        menuStrip1.Items.AddRange(New ToolStripItem() {mainToolStripMenuItem})
        Controls.Add(menuStrip1)
        MainMenuStrip = menuStrip1
        Text = "ToolStripRadioButtonMenuItem demo"
    End Sub
End Class

Public Class Program

    <STAThread()> Public Shared Sub Main()
        Application.EnableVisualStyles()
        Application.SetCompatibleTextRenderingDefault(False)
        Application.Run(New Form1())
    End Sub

End Class

Açıklamalar

özelliği tarafından DropDownItems DropDown başvuruda bulunılan içindeki ToolStripDropDown tüm öğeleri almak için özelliğini kullanın.

Şunlara uygulanır