Common events WinForm

From time to time update ...

Load: Raised when the form loads;

LocationChanged:

KeyDown: Generally used as shortcut keys such as CTRL + S, the save

FormClosed: After the form is closed, such as landing a form as the startup form, after closing the implementation of "Application.Exist ()"

FormClosing: Form is performing closed, it has not been closed for "Do you really want to close it?"

private void FrmMain_FormClosing(object sender, EventArgs e)
{
    if (
        MessageBox.Show(
            "你确定要退出吗?", 
            "提示", 
            MessageBoxButtons.YesNo, 
            MessageBoxIcon.Question
        ) == DialogResult.No)
    {
        e.Cancel = true;    // 阻止默认的“关闭”事件
    }
}

SizeChanged:

Resize:

Reproduced in: https: //www.cnblogs.com/rainman/p/3647729.html

Guess you like

Origin blog.csdn.net/weixin_34416649/article/details/93561359