【发布时间】:2017-07-10 20:31:57
【问题描述】:
如何禁用关闭按钮 WPF ?我不想隐藏,我只想禁用窗口的关闭按钮
是否有禁用关闭按钮的逻辑?
【问题讨论】:
如何禁用关闭按钮 WPF ?我不想隐藏,我只想禁用窗口的关闭按钮
是否有禁用关闭按钮的逻辑?
【问题讨论】:
您可以编写事件代码,并在您关闭按钮时停止。 可能是我英语速度不太好,但你看代码还行。
in wpf this event called Closing :
public Window4()
{
InitializeComponent();
this.Closing += new System.ComponentModel.CancelEventHandler(Window4_Closing);
}
void Window4_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
}
【讨论】: