From d1e71f032352fb128fa1b1ca72a91a8215ba7a74 Mon Sep 17 00:00:00 2001 From: Mute Date: Thu, 13 Aug 2026 08:11:16 +0000 Subject: [PATCH] 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 --- win/gatuna-client/MainForm.cs | 20 +++++++++++--------- win/gatuna-client/Program.cs | 5 +++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/win/gatuna-client/MainForm.cs b/win/gatuna-client/MainForm.cs index 23f78c4..3a01721 100644 --- a/win/gatuna-client/MainForm.cs +++ b/win/gatuna-client/MainForm.cs @@ -17,9 +17,6 @@ public partial class MainForm : Form Text = "gatuna"; Width = 520; Height = 380; - FormBorderStyle = FormBorderStyle.FixedSingle; - MaximizeBox = false; - MinimizeBox = false; StartPosition = FormStartPosition.CenterScreen; InitializeComponents(); @@ -146,14 +143,19 @@ public partial class MainForm : Form } } + protected override void OnResize(EventArgs e) + { + base.OnResize(e); + if (WindowState == FormWindowState.Minimized) + { + Hide(); + WindowState = FormWindowState.Normal; + } + } + protected override void OnFormClosing(FormClosingEventArgs e) { - if (e.CloseReason == CloseReason.UserClosing) - { - e.Cancel = true; - Hide(); - return; - } + Shutdown(); base.OnFormClosing(e); } diff --git a/win/gatuna-client/Program.cs b/win/gatuna-client/Program.cs index caef5dc..2b49f80 100644 --- a/win/gatuna-client/Program.cs +++ b/win/gatuna-client/Program.cs @@ -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(); };