本文整理汇总了C#中System.Windows.Forms.ToolStripDropDownItem.DropDownItems属性的典型用法代码示例。如果您正苦于以下问题:C# ToolStripDropDownItem.DropDownItems属性的具体用法?C# ToolStripDropDownItem.DropDownItems怎么用?C# ToolStripDropDownItem.DropDownItems使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Windows.Forms.ToolStripDropDownItem
的用法示例。
在下文中一共展示了ToolStripDropDownItem.DropDownItems属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MenuStrip
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());
}
}