using System;
using System.Windows.Forms;
using System.Drawing;
class myfrm : Form
{
MainMenu m;
MenuItem file, edit;
MenuItem exit, close;
MenuItem cut, copy, paste;
public myfrm()
{
m = new MainMenu();
file = new MenuItem("File");
edit = new MenuItem("Edit");
exit = new MenuItem("Exit");
close = new MenuItem("Close");
cut = new MenuItem("cut");
copy = new MenuItem("copy");
paste = new MenuItem("paste");
file.MenuItems.Add(exit);
file.MenuItems.Add(close);
edit.MenuItems.Add(cut);
edit.MenuItems.Add(copy);
edit.MenuItems.Add(paste);
m.MenuItems.Add(file);
m.MenuItems.Add(edit);
this.Menu = m;
cut.Click +=new EventHandler(fun);
}
void fun(object o, EventArgs e)
{
MessageBox.Show("cut clicked");
}
}
class Program
{
static void Main(string[] args)
{
myfrm f = new myfrm();
f.ShowDialog();
}
}
No comments:
Post a Comment