简体   繁体   中英

Disable closing button on opened modal dialogs Windows Forms C#

Say I open a dialog like this:

        Login login = new Login();
        if(login.ShowDialog(this) != DialogResult.OK)
            Application.Exit();

Now, login form has a close button in the menu by standard, and closing it seem to either return DialogResult.OK or no dialogresult at all and my application continues without repercussions. How to solve that problem?

ControlBox属性设置为false。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM