Stopping keypresses
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.
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Kirtan PatelRank #292 · 8.6K reputationPosted May 18, 2009, 7:30 AM EDT
patrickRank #4,458 · 342 reputationPosted May 18, 2009, 7:57 AM EDT
patrickRank #4,458 · 342 reputationPosted May 18, 2009, 8:21 AM EDT