I got answer for disabling the x button in windows forms but is it possible for completly make hide/invisible the close(X) button and move the maximum button to close(x) btn position and minimum button to maximum button position in a form. without creating custom/user control/new forms
-
Have a look on this: http://stackoverflow.com/questions/7301825/windows-forms-how-to-hide-close-x-button It seems it is not possible. – Andy May 31 '13 at 12:16
-
You can disable it, but not hide it, as per the referenced duplicate question. – John Willemse May 31 '13 at 12:39
3 Answers
I don't believe you can hide it without hiding/removing the entire control box. The best solution would be to disable it if you don't want a using pressing the (x) button.

- 236
- 1
- 14
@Andy is correct, it's not possible. Those buttons are located in what's called the Non-Client area of the window—meaning that part of the window is (more or less) controlled by Windows and not the program "hosted" in the Window. Note that disabling the Close button also disables the Window's system menu (or Control box menu).
What you may want to do is hide all the title bar buttons and create new buttons on your application form that minimize and maximize the application.
However, I would ask why you feel the need to move the buttons? If you must move the buttons or have a different design for them, I know applications like Trend Micro anti-virus "skin" the window by providing an image for the application window and create custom (a/k/a owner-) drawn controls. They also "skin" the Non-Client area, effectively designing how/where they want the title bar text displayed, the minimize/maximize buttons, etc. But that's a lot of work and generally doesn't look as polished (in my opinion). Plus, people are just plain used to the standard Windows form, which is why it's "standard".
One more thing to think about is using WPF. You can basically redefine the Window template, thereby changing the look and feel (and position) of, generally, non-client area buttons such as the Minimize and Maximize buttons.

- 4,032
- 1
- 35
- 48
You have to ownerdraw the thing,
- Hide all status bar setting FormBorderStyle to none
- Place a Panel At the top of the form using Dock Top
- Create the buttons you need (Minimize, maximize)
- Make the Panel Title bar that grags the form Make a borderless form movable

- 1
- 1

- 3,715
- 5
- 30
- 46