Ignorer Alt + F4 dans l'application WPF Comment puis-je ignorer Alt+F4 dans une Application WPF? source d'informationauteur kartal c#wpf 14 Vous pouvez impement OnClosing événement sur TForm et définir cea.Cancel = true; lors de la cea est CancelEventArgs de OnClosing argument. 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 31 Ajouter à la UIElement/FramworkElement d'où vous ne souhaitez pas le Alt+F4 pour travailler. wnd.KeyDown += new KeyEventHandler(wnd_KeyDown); void wnd_KeyDown(object sender, KeyEventArgs e) { if ( e.Key == Key.System && e.SystemKey == Key.F4) { e.Handled = true; } } 8 Simplement utiliser les commentaires de liaison comme ce à votre avis(Xaml) Fichier: <Window.InputBindings> <KeyBinding Modifiers="Alt" Key="F4" Command="{Binding Path=ToDelegateCommandThatExecuteNothing}" /> </Window.InputBindings> Vous devez vous connecter pour publier un commentaire.
Vous pouvez impement
OnClosing
événement surTForm
et définircea.Cancel = true;
lors de la cea estCancelEventArgs
deOnClosing
argument.http://msdn.microsoft.com/en-us/library/system.windows.forms.form.onclosing.aspx
C#
C++
VB.NET
Ajouter à la
UIElement/FramworkElement
d'où vous ne souhaitez pas le Alt+F4 pour travailler.Simplement utiliser les commentaires de liaison comme ce à votre avis(Xaml) Fichier: