e.cancel 没有定义private void Form1_FormClosed(object sender,FormClosedEventArgs e){DialogResult dr = MessageBox.Show("是否关闭窗体!","信息提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);if (dr == DialogResult.Cancel){e.Cancel
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/30 14:12:08
e.cancel 没有定义private void Form1_FormClosed(object sender,FormClosedEventArgs e){DialogResult dr = MessageBox.Show("是否关闭窗体!","信息提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);if (dr == DialogResult.Cancel){e.Cancel
e.cancel 没有定义
private void Form1_FormClosed(object sender,FormClosedEventArgs e)
{
DialogResult dr = MessageBox.Show("是否关闭窗体!","信息提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);
if (dr == DialogResult.Cancel)
{
e.Cancel = true;
}
}
错误 1 “System.Windows.Forms.FormClosedEventArgs”不包含“Cancel”的定义,并且找不到可接受类型为“System.Windows.Forms.FormClosedEventArgs”的第一个参数的扩展方法“Cancel”(是否缺少 using 指令或程序集引用?
用的vs2010
e.cancel 没有定义private void Form1_FormClosed(object sender,FormClosedEventArgs e){DialogResult dr = MessageBox.Show("是否关闭窗体!","信息提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);if (dr == DialogResult.Cancel){e.Cancel
你的事件添加错了
只有Form_Closing事件中 e.Cancel可以用.你的是Form_Closed事件. Form_Closed事件时窗口已关了 ,Cancel没用了;Form_Closing是窗口即将关闭时询问你是不是真的关闭才有Cancel事件