// Members for a simple menu system.
private MenuStrip mnuMainMenu = new MenuStrip();
private ToolStripMenuItem mnuFile = new ToolStripMenuItem();
private ToolStripMenuItem mnuFileExit = new ToolStripMenuItem();
public MainWindow(string title, int height, int width)
{
...
BuildMenuSystem();
}
private void BuildMenuSystem()
{
// Add the File menu item to the main menu.
mnuFile.Text = "&File";
mnuMainMenu.Items.Add(mnuFile);
// Now add the Exit menu to the File menu.
mnuFileExit.Text = "E&xit";
mnuFile.DropDownItems.Add(mnuFileExit);
mnuFileExit.Click += new System.EventHandler(this.mnuFileExit_Click);
Controls.Add(this.mnuMainMenu);
MainMenuStrip = this.mnuMainMenu;
}
Do'stlaringiz bilan baham: |