diff --git a/ShareX/Tools/PinToScreen/PinToScreenForm.Designer.cs b/ShareX/Tools/PinToScreen/PinToScreenForm.Designer.cs index 646afde92..48ed9877c 100644 --- a/ShareX/Tools/PinToScreen/PinToScreenForm.Designer.cs +++ b/ShareX/Tools/PinToScreen/PinToScreenForm.Designer.cs @@ -27,7 +27,6 @@ private void InitializeComponent() this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.Text = "ShareX - Pin to screen"; - this.TopMost = true; this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.PinToScreenForm_KeyUp); this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PinToScreenForm_MouseDown); this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PinToScreenForm_MouseUp); diff --git a/ShareX/Tools/PinToScreen/PinToScreenForm.cs b/ShareX/Tools/PinToScreen/PinToScreenForm.cs index 0a5c4e20b..a77ab0f1c 100644 --- a/ShareX/Tools/PinToScreen/PinToScreenForm.cs +++ b/ShareX/Tools/PinToScreen/PinToScreenForm.cs @@ -114,6 +114,7 @@ private PinToScreenForm(PinToScreenOptions options) ImageOpacity = Options.InitialOpacity; InitializeComponent(); + TopMost = Options.TopMost; SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true); isDWMEnabled = NativeMethods.IsDWMEnabled(); @@ -162,6 +163,7 @@ private void AutoSizeForm() } Point newLocation = Location; + SpecialWindowHandles insertAfter = Options.TopMost ? SpecialWindowHandles.HWND_TOPMOST : SpecialWindowHandles.HWND_TOP; SetWindowPosFlags flags = SetWindowPosFlags.SWP_NOACTIVATE; if (Options.KeepCenterLocation) @@ -174,7 +176,7 @@ private void AutoSizeForm() flags |= SetWindowPosFlags.SWP_NOMOVE; } - NativeMethods.SetWindowPos(Handle, (IntPtr)SpecialWindowHandles.HWND_TOPMOST, newLocation.X, newLocation.Y, newSize.Width, newSize.Height, flags); + NativeMethods.SetWindowPos(Handle, (IntPtr)insertAfter, newLocation.X, newLocation.Y, newSize.Width, newSize.Height, flags); Refresh(); } diff --git a/ShareX/Tools/PinToScreen/PinToScreenOptions.cs b/ShareX/Tools/PinToScreen/PinToScreenOptions.cs index 7e2988bd0..a10642264 100644 --- a/ShareX/Tools/PinToScreen/PinToScreenOptions.cs +++ b/ShareX/Tools/PinToScreen/PinToScreenOptions.cs @@ -36,6 +36,7 @@ public class PinToScreenOptions public int OpacityStep { get; set; } = 10; public ContentAlignment Placement { get; set; } = ContentAlignment.BottomRight; public int PlacementOffset { get; set; } = 10; + public bool TopMost { get; set; } = true; public bool KeepCenterLocation { get; set; } = true; public bool ShowShadow { get; set; } = true; public Color BackgroundColor { get; set; } = Color.White;