网站首页 博客 C#信息提示框
C#信息提示框
 2017-05-26 15:45:51  管理员  161

参数定义:

string message = "You did not enter a server name. Cancel this operation?"; //提示信息
string caption = "No Server Name Specified"; //标题
MessageBoxButtons buttons = MessageBoxButtons.YesNo; //按钮数量,YesNo表示确定和取消
DialogResult result;

使用方法:

//显示MessageBox.
result = MessageBox.Show(this, message, caption, buttons);
//如果点击的是"YES"按钮,将form关闭.
if(result == DialogResult.Yes)
{
    // Closes the parent form.
    this.Close();
}


来说两句吧
最新评论