1. MenuStrip Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | using System; using System.Windows.Forms; namespace WindowsFormsApp3 { class CsMenuBar { MenuStrip menubar; ToolStripMenuItem currMenu; public CsMenuBar() { menubar = new MenuStrip(); menubar.Items.Clear(); } public MenuStrip get() { return menubar; } public void addMenu(String name) { currMenu = new ToolStripMenuItem(); currMenu.Tag = "menuitem"; currMenu.Name = name; currMenu.Text = name; menubar.Items.Add(currMenu); } public void addMenuItem(String name, EventHandler handler) { ToolStripMenuItem item = new ToolStripMenuItem(); item.Tag = "menuitem"; item.Name = name; item.Text = name; item.Click += new EventHandler(handler); currMenu.DropDownItems.Add(item); } } } |
댓글 없음:
댓글 쓰기