views:

17

answers:

2

Is there a way (using C#) to hide and disable the minimize/close button?

I have a form that I use for login, and I would just rather they not be able to close the window.

Failing hiding the button, is there a way to catch that it was pressed and ignore/re-direct it?

+1  A: 

Change the BorderStyle to None and make it the size of the screen. You can optionally draw in a "caption" area manually to make it look like there is a caption.

ctacke
I liked the idea, but the title bar (and it's minimize button) are still shown. My form (now full screen) is under it.
Vaccano
A: 

This ended up working:

this.MaximizeBox = false;
this.MinimizeBox = false;
this.ControlBox = false;
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;

It got rid of the whole title bar, but that is ok for my purposes.

Vaccano