How To Disable R.A.D Form 's close button

5 posts, 0 answers
  1. Daniel Kuo
    Daniel Kuo avatar
    13 posts
    Member since:
    Mar 2007

    Posted 25 Aug 2009 Link to this post


    I found a way to disable wimform's close button on codeproject

    but it's not working  on R.A.D form (Q1 2009 SP1)  with vista theme.

    can you provide a way to disable close button of R.A.D form?

  2. Deyan
    Deyan avatar
    2026 posts

    Posted 25 Aug 2009 Link to this post

    Hello Daniel,

    You can use the following approach to disable the Close button of a RadForm component:

    public RadFormTestForm() 
                this.FormElement.TitleBar.CloseButton.Enabled = false
            private const int CP_NOCLOSE_BUTTON = 0x200; 
            protected override CreateParams CreateParams 
                    CreateParams myCp = base.CreateParams; 
                    myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON; 
                    return myCp; 

    Basically, the CreateParams property removes the style that shows a close button in the system menu and in the title bar of a standard windows form. However, since RadForm customizes the standard non-client area of a Windows Form, you will have to additionally disable the Close button in our Title Bar and also apply the style that removes it from the system menu (so that the user will not be able to still close the form from the system menu) .

    I hope this is helpful.

    Kind regards,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Daniel Kuo
    Daniel Kuo avatar
    13 posts
    Member since:
    Mar 2007

    Posted 25 Aug 2009 Link to this post

    Hi :

    thanks, it works


  5. Holger Boskugel
    Holger Boskugel avatar
    24 posts
    Member since:
    Apr 2012

    Posted 05 Jun 2012 Link to this post


    There is no (longer) need to override CreateParams. Only the settings for CloseButton in constructor are relevant. There you can also remove the CloseButton by Visibility = Hidden.

    Regards from Leipzig

  6. Ivan Petrov
    Ivan Petrov avatar
    701 posts

    Posted 08 Jun 2012 Link to this post

    Hello guys,

    Thank you all for writing.

    There are several properties which control the visibility of the minimize, maximize and close buttons. You can use RadForm properties MinimizeBox, MaximizeBox and ControlBox. Or you can directly access the buttons elements:

    You can then use the Visibility property to show/hide these button elements.

    I hope this will be useful. Should you have further questions, feel free to write back.

    Ivan Petrov
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top
DevCraft banner