Tag Archives: FormBorderStyle
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.
const int WS_MINIMIZEBOX = 0x20000;
const int CS_DBLCLKS = 0x8;
protected override CreateParams CreateParams
CreateParams cp = base.CreateParams;
cp.Style |= WS_MINIMIZEBOX;
cp.ClassStyle |= CS_DBLCLKS;
Posted in C#.
Tagged C#, CS_DBLCLKS, csharp, FormBorderStyle, snippet, winforms, WS_MINIMIZEBOX