Skip to content

Commit c8ca524

Browse files
committed
changed exit menu to a single line of code
1 parent 2115c3f commit c8ca524

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

MenuGenerator.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public MenuGenerator(Settings settings)
2121
private static ContextMenuStrip GenerateMenu()
2222
{
2323
var menu = new ContextMenuStrip();
24+
menu.SuspendLayout();
2425

2526
menu.Items.AddRange(new ToolStripItem[]
2627
{
@@ -30,9 +31,9 @@ private static ContextMenuStrip GenerateMenu()
3031
menu.Items.AddRange(GetColorMenu());
3132
menu.Items.Add(new ToolStripSeparator());
3233

33-
var menuExit = new ToolStripMenuItem { Text = "E&xit" };
34-
menuExit.Click += new EventHandler((a, b) => Application.Exit());
35-
menu.Items.AddRange(new ToolStripMenuItem[] { menuExit });
34+
menu.Items.Add("Exit", _settings.resourceSet.GetObject("Exit") as Image, (a, b) => Application.Exit());
35+
36+
menu.ResumeLayout(false);
3637

3738
return menu;
3839
}

0 commit comments

Comments
 (0)