是否可以禁用WPF表单中的关闭按钮?如何禁用关闭按钮?
我一直在寻找并找到下面的解决方案.但这只适用于Windows窗体!
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
}
Run Code Online (Sandbox Code Playgroud)
use*_*519 17
在wpf这个名为Closing的事件中:
public Window4()
{
InitializeComponent();
this.Closing += new System.ComponentModel.CancelEventHandler(Window4_Closing);
}
void Window4_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
}
Run Code Online (Sandbox Code Playgroud)