久久亚洲精品国产精品_羞羞漫画在线版免费阅读网页漫画_国产精品久久久久久久久久久久_午夜dj免费观看在线视频_希崎杰西卡番号

dialogresult(dialogresult不讓他一直彈窗)

前沿拓展:

dialogresult

樓上的說(shuō)的挺仔細(xì)了,這是一個(gè)例子,運(yùn)行下就知道了.

string message = “You did not enter a server name. Cancel this operation?”;

string caption = “No Server Name Specified”;

MessageBoxButtons buttons = MessageBoxButt石編至型刻幾步酸ons.YesNo;

DialogResult

拓展知識(shí):

dialogresult

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
MessageBox.Show("提示?", "是否確認(rèn)退出?",MessageBoxButtons.OKCancel,MessageBoxicon.information)

}
其實(shí)不用判斷.點(diǎn)擊窗口右上角的X,會(huì)彈出對(duì)話框,如果選擇是OK的話,會(huì)關(guān)閉窗口,點(diǎn)取消相當(dāng)與什么都沒(méi)做

dialogresult

this.Dispose(); //釋放資源
this.Close(); //關(guān)閉程序(窗口)

dialogresult

取消按鈕是自己設(shè)計(jì)的話,直接把form 的cancel result button設(shè)置成這個(gè)button;
或者在點(diǎn)擊button的時(shí)候this.dialogresult=cancel;

dialogresult

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (MessageBox.Show("確定關(guān)閉窗口?", "", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
{
e.Cancel = true;
}
}

原創(chuàng)文章,作者:九賢生活小編,如若轉(zhuǎn)載,請(qǐng)注明出處:http://www.cddhlm.com/33436.html