Often when using software these days, the ESC key will close a dialog without persisting any changes I've made. I like that especially because even though the dialog may have a cancel button on it, I don't necessarily want to reach for the mouse or tab over to the cancel button. It's a nice clean way of saying "Oops, didn't meant to do that!" to the software. In fact, I find I get annoyed with software that doesn't implement this feature and I can't believe that it's not already done under the hood of Winforms - seems intuitive to me...
I have looked at hooking into the Form KeyPress event, or trying to simulate a "Cancel" DialogResult etc. There seem to be a number of ways of going about this...
So the question is: What is the cleanest way of going about binding the ESC key to close the dialog without saving any changes?
Any help from those that have experience in this is much appreciated!