Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
Set the ControlBox property to False to remove icon, system menu and buttons from the title bar. I'm pretty sure there is no way to actually disable that button, i.e. have it be there but "greyed out", in .NET. You need to either get rid of it, which is a bit of a baby and bath water situation, or determine whether it was clicked and act accordingly. You can set a variable when a legal closing method is used and set e.cancelled to True in the form's Closing event handler if that variable is not set. You can also intercept the Windows Message that is sent when that button is clicked using the by overriding the WndProc method. I can't remember what the message is but I've seen mention of it several times in several different places.
Posted
I'm pretty sure there is no way to actually disable that button' date=' i.e. have it be there but "greyed out", in .NET. [/quote']

 

.NET no, using some old win32 methods it should be possible. I've done it in a VB5 application although that was such a long time ago that I dont remember the exact details ;).

 

Bit of googling and msdning:

http://support.microsoft.com/?kbid=245746

this is for an access database, but they dont use access methods (access doesnt support disabling the close button either) but they use win32 functions. This means you should be able to use this solution in .net as well.

Nothing is as illusive as 'the last bug'.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...