add minimize button to hotkey window

This commit is contained in:
Kang Yu 2024-04-13 18:15:14 -07:00
parent 4c2cde17d5
commit 963d0bad24
2 changed files with 11 additions and 1 deletions

View file

@ -151,7 +151,6 @@ namespace PersistentWindows.Common
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.KeyPreview = true; this.KeyPreview = true;
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "HotKeyWindow"; this.Name = "HotKeyWindow";
this.Opacity = 0.5D; this.Opacity = 0.5D;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;

View file

@ -57,6 +57,7 @@ namespace PersistentWindows.Common
MouseWheel += new MouseEventHandler(FormMouseWheel); MouseWheel += new MouseEventHandler(FormMouseWheel);
FormClosing += new FormClosingEventHandler(FormClose); FormClosing += new FormClosingEventHandler(FormClose);
MouseLeave += new EventHandler(FormMouseLeave); MouseLeave += new EventHandler(FormMouseLeave);
SizeChanged += new EventHandler(FormSizeChanged);
Icon = PersistentWindowProcessor.icon; Icon = PersistentWindowProcessor.icon;
@ -827,5 +828,15 @@ namespace PersistentWindows.Common
return PersistentWindowProcessor.GetForegroundWindow(); return PersistentWindowProcessor.GetForegroundWindow();
} }
private void FormSizeChanged(object sender, EventArgs e)
{
if (WindowState == FormWindowState.Minimized)
{
//User32.ShowWindow(handle, (int)ShowWindowCommands.Normal);
WindowState = FormWindowState.Normal;
ToggleWindowSize();
Visible = true;
}
}
} }
} }