restore standard window controls, minimize-to-tray, close-exits
- Restore default FormBorderStyle (resizable with min/max/close buttons) - Minimize button hides to tray (WindowState=Minimized -> Hide()) - Close button and tray Exit both call Shutdown() then close normally - Tray Show/DoubleClick restores window from tray
This commit is contained in:
@@ -20,18 +20,19 @@ static class Program
|
||||
tray.ContextMenuStrip.Items.Add("Show", null, (_, _) =>
|
||||
{
|
||||
form.Show();
|
||||
form.WindowState = FormWindowState.Normal;
|
||||
form.Activate();
|
||||
});
|
||||
tray.ContextMenuStrip.Items.Add("-");
|
||||
tray.ContextMenuStrip.Items.Add("Exit", null, (_, _) =>
|
||||
{
|
||||
form.Shutdown();
|
||||
tray.Visible = false;
|
||||
Application.Exit();
|
||||
form.Close();
|
||||
});
|
||||
tray.DoubleClick += (_, _) =>
|
||||
{
|
||||
form.Show();
|
||||
form.WindowState = FormWindowState.Normal;
|
||||
form.Activate();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user