使用c#的windows窗体中的不可关闭窗口?
当我单击windows窗体上的“提交”按钮时,它会弹出一个没有关闭(X)按钮的弹出窗口(询问“是”或“否”),即使我们在该弹出窗口因响应而闪烁的任何位置单击该按钮使用c#的windows窗体中的不可关闭窗口?,c#,.net,C#,.net,当我单击windows窗体上的“提交”按钮时,它会弹出一个没有关闭(X)按钮的弹出窗口(询问“是”或“否”),即使我们在该弹出窗口因响应而闪烁的任何位置单击该按钮 那么怎么做呢?订阅表单的“关闭”事件,进行一些检查,如果要阻止表单关闭,请将e.Cancel设置为true private bool _incomplete; private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs
那么怎么做呢?订阅表单的“关闭”事件,进行一些检查,如果要阻止表单关闭,请将e.Cancel设置为true
private bool _incomplete;
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (_incomplete)
{
e.Cancel = true;
}
}
另外,下次发帖前请先搜索谷歌,这不是StackOverflow的工作方式,你看。@Anandkumar此问题中没有任何异常迹象CodeMaster弹出窗口表单显示(X)按钮。所以我可以不回答就关闭它,即是或否。我只需要回答即可关闭该窗口。现在你明白我的意思了吗???
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Test","abc",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
}