Tag Archives: CS_DBLCLKS
Minimize a form without border using the taskbar
By default borderless forms are not designed to be minimized, which means when the form’s FormBorderStyle
property is set to None you will notice that clicking the application box in taskbar does not minimize the form.
This can be fixed by overriding CreateParams
and adding the WS_MINIMIZEBOX
style to the Window and CS_DBLCLKS
to the Window class styles.
Simply place the following code inside your Form’s class which you want to enable the minimize functionality using the taskbar.
1 2 3 4 5 6 7 8 9 10 11 12 13 | const int WS_MINIMIZEBOX = 0x20000; const int CS_DBLCLKS = 0x8; protected override CreateParams CreateParams { get { CreateParams cp = base.CreateParams; cp.Style |= WS_MINIMIZEBOX; cp.ClassStyle |= CS_DBLCLKS; return cp; } } |
Posted in C#.
Tagged C#, CS_DBLCLKS, csharp, FormBorderStyle, snippet, winforms, WS_MINIMIZEBOX