User Tools

Site Tools

blog:2023-06-06_c_disable_close_button_x_in_windows_form



2023-06-06 C#: Disable Close Button(X) in Windows Form

  • We need disable close button function in win form.

Solution

  •         //Disable close button
            private const int CP_DISABLE_CLOSE_BUTTON = 0x200;
            protected override CreateParams CreateParams
            {
                get
                {
                    CreateParams cp = base.CreateParams;
                    cp.ClassStyle = cp.ClassStyle | CP_DISABLE_CLOSE_BUTTON;
                    return cp;
                }
            }

TAGS

  • 48 person(s) visited this page until now.

Permalink blog/2023-06-06_c_disable_close_button_x_in_windows_form.txt · Last modified: 2023/06/06 11:40 by jethro

oeffentlich