Tag Archives: FormBorderStyle

Move borderless form using mouse

Forms that have their FormBorderStyle set to None cannot be moved using the mouse by default. In order to achieve this functionally we can use the ReleaseCapture and SendMessage Windows functions.

Simply place the following code in your borderless form class.

Don’t forget to assign your form’s MouseDown event to the form1_MouseDown method !

Keep in mind that you could handle another control’s MouseDown event (a good example would be a MenuStrip control) instead of the form’s one, making your form moveable only when the user clicks and drags that specific control.

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.