Jon Skeet [C# MVP] schreef:
I want to get rid of the x altogether. Setting Form.FormBorderStyle to
FormBorderStyle.FixedToolWindow removes the Minimize - and Maximize boxes
but leaves the x in place. How can I remove it and still have a caption on
top of my Form?
This area is poorly handled by MSFT. Check out the "Form.ControlBox"
property but if this doesn't do what you want then see here:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1120746&SiteID=1
Note that this technique assumes the "Close" menu item is the last on the
menu. MSFT also used to have a KB article that actually hardcoded it as item
6 (which it always has been on the standard system menu). Neither assumption
is the safest IMO but I'm not aware of any easy way to do it both
accurately and cleanly. In practice you'll probably be safe with the first
technique but note that you'll also want to delete the line separator that
immediately precedes it on the system menu. Of course you need to know that
it is a line separator so MSFT's KB article used to delete both items 5 and
6 IIRC. Getting deeper into Win32 (not to mention potential translation
issues) will probably allow for accurate control of things if you feel
uneasy with all this (as I do though I've had no issues so far - if it was
good enough for MSFT's KB article then hopefully it's safe)