In a Form, you can enable/disable miximize/minimize button control easily by FormObject.MaximizeButton or FormObject.MinimizeButton property. But unfortunately, there is no such property for close button. You can disable the close button by overriding a property in your form class like below.
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; } } |
Note: This procedure works for disabling the close button at the time of form loading, not after loading the form.
0 Comments:
Post a Comment