如何在
WPF应用程序中忽略Alt F4?
解决方法
您可以在TForm上施加OnClosing事件,并设置cea.Cancel = true;当cea是FromClosing参数的CancelEventArgs时.
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.onclosing.aspx
C#
private void Form1_Closing(Object sender,CancelEventArgs e) { e.Cancel = true; }
C
void Form1_Cancel( Object^ /*sender*/,CancelEventArgs^ e ) { e->Cancel = true; }
VB.NET
Private Sub Form1_Closing(sender As Object,e As _ System.ComponentModel.CancelEventArgs) Handles MyBase.Closing e.Cancel = True End Sub 'Form1_Closing