Disable close button in windows forms using C#

No.of Views2486
Bookmarked0 times
Downloads 
Votes0
By  vinothnat   On  15 Feb 2010 22:02:37
Tag : CSharp , Windows Forms
Disable close button in windows forms using C#
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Hi all,

Here I am trying to explain you how to disable the windows Form's close button by using our C# coding in DotNet.

Just copy the following code in your code behind. Then run the form, surely the close button would be disabled.

{codecitation class="brush: c#; gutter: true;" width="500px"}

private const int CP_NOCLOSE_BUTTON = 0x200;


protected override CreateParams CreateParams
{
get
{
CreateParams myCp = base.CreateParams;
myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON;
return myCp;
}
}

{/codecitation}

...S.VinothkumaR.

http://vinothnat.blogspot.com

 
Sign Up to vote for this article
 
About Author
 
vinothnat
Occupation-Not Provided
Company-Not Provided
Member Type-Junior
Location-Not Provided
Joined date-03 Jun 2009
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top