当前位置:网站首页>C WinForm [exit application] - practice 3

C WinForm [exit application] - practice 3

2022-07-05 07:55:00 BoomBiuBiu

1、 Add an exit button on the menu bar

 2、 Double click the exit button , Add code on the form

private void  sign out ToolStripMenuItem_Click(object sender, EventArgs e)
{
    if (MessageBox.Show(" Whether to quit the program ", " ", MessageBoxButtons.OKCancel,MessageBoxIcon.Warning) == DialogResult.OK)
    {
        Close();
    }
}

3、 Run the program , Show results

 

原网站

版权声明
本文为[BoomBiuBiu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140548302992.html