WinForm messagebox 确定取消按钮事件

private void button2_Click(object sender, EventArgs e)
        {           
            MessageBox.Show("ABC",MessageBoxButtons.OKCancel);
        }

if(DialogResult.OK==MessageBox.Show("ABC",MessageBoxButtons.OKCancel))
{
//点击了OK
}
else
{
//点击了Cancel
}

转载于:https://www.cnblogs.com/deepwishly/archive/2010/07/22/2551223.html

你可能感兴趣的:(c#)