Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1904 Unable to minimize ImageGlass #1906

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Source/Components/ImageGlass.Settings/Forms/ToolForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,20 @@ public partial class ToolForm : ThemedForm

protected override bool ShowWithoutActivation => true;


protected override CreateParams CreateParams
{
get
{
CreateParams baseParams = base.CreateParams;
var cp = base.CreateParams;

const int WS_EX_NOACTIVATE = 0x08000000;
baseParams.ExStyle |= WS_EX_NOACTIVATE;
const int WS_MINIMIZEBOX = 0x20000;

cp.ExStyle |= WS_EX_NOACTIVATE;
cp.Style ^= WS_MINIMIZEBOX; // hide Minimize box

return baseParams;
return cp;
}
}

Expand Down
21 changes: 21 additions & 0 deletions Source/Components/ImageGlass.UI/Forms/ModernForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,27 @@ public ModernForm()
// Protected / virtual methods
#region Protected / virtual methods

protected override CreateParams CreateParams
{
get
{
// ensure that when in full-screen or frameless mode we can still use the
// Windows shortcut keys to minimize, and allow the taskbar icon to minimize
// the window.
// ref https://www.fluxbytes.com/csharp/minimize-a-form-without-border-using-the-taskbar/

const int WS_MINIMIZEBOX = 0x20000;
const int CS_DBLCLKS = 0x8;

var cp = base.CreateParams;
cp.Style |= WS_MINIMIZEBOX;
cp.ClassStyle |= CS_DBLCLKS;

return cp;
}
}


protected override void WndProc(ref Message m)
{
// WM_SYSCOMMAND
Expand Down
1 change: 0 additions & 1 deletion Source/ImageGlass/FrmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ public async Task PrepareLoadingAsync(string[] paths, string? currentFile = null
}
}


/// <summary>
/// Load the images list.
/// </summary>
Expand Down