mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Topmost notification form otherwise sometimes not show up when in desktop
This commit is contained in:
parent
4b719fee96
commit
be93e8dd08
2 changed files with 9 additions and 2 deletions
6
ShareX/Forms/NotificationForm.Designer.cs
generated
6
ShareX/Forms/NotificationForm.Designer.cs
generated
|
@ -17,6 +17,12 @@ protected override void Dispose(bool disposing)
|
|||
{
|
||||
components.Dispose();
|
||||
}
|
||||
|
||||
if (ToastImage != null)
|
||||
{
|
||||
ToastImage.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
|
|
|
@ -95,13 +95,15 @@ public static void Show(string imagePath, string url)
|
|||
Image img = ImageHelpers.LoadImage(imagePath);
|
||||
NotificationForm form = new NotificationForm(5000, new Size(400, 300), img, url);
|
||||
NativeMethods.ShowWindow(form.Handle, (int)WindowShowStyle.ShowNoActivate);
|
||||
NativeMethods.SetWindowPos(form.Handle, (IntPtr)SpecialWindowHandles.HWND_TOP, 0, 0, 0, 0,
|
||||
NativeMethods.SetWindowPos(form.Handle, (IntPtr)SpecialWindowHandles.HWND_TOPMOST, 0, 0, 0, 0,
|
||||
SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOACTIVATE);
|
||||
}
|
||||
}
|
||||
|
||||
private void NotificationForm_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
tDuration.Stop();
|
||||
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(URL))
|
||||
|
@ -110,7 +112,6 @@ private void NotificationForm_MouseClick(object sender, MouseEventArgs e)
|
|||
}
|
||||
}
|
||||
|
||||
tDuration.Stop();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue