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; } } |
Thank You CoolMine Its Really Work For Me. Great Job Keep It Up…
Thank you for taking the time to post your feedback.
Dug for this for multiple hours. Thank you very much for sharing; was exactly what I needed!
Thank you, its working…
Thank you, it works very well
can i know how did u get the value “0x20000” and “0x8”
You can find the values for the window styles at https://msdn.microsoft.com/en-us/library/windows/desktop/ms632600%28v=vs.85%29.aspx and for mouse clicks at https://msdn.microsoft.com/en-us/library/windows/desktop/gg153548%28v=vs.85%29.aspx
Thank You CoolMine Its Really Work For Me. Great Job Keep It Up…