patrick

patrick

  • NA
  • 397
  • 0

stopping keypresses

May 18 2009 11:20 AM
Im using this code to try to block closing keys, but alt-f4 still closes the form. protected override void OnKeyDown(KeyEventArgs e) { if (e.KeyData==Keys.F4||e.Modifiers==Keys.Alt) { e.SuppressKeyPress = true; e.Handled = false; } } The purpose was to stop these keypresses, add an exit button(the only way to close the form) and get a password before letting the form close.

Answers (3)