Re: Dialog: Cancel button / esc key (Windows forms) by WP
WP
Fri Mar 14 17:42:23 CDT 2008
On 14 Mar, 23:18, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com> wrote:
> On Fri, 14 Mar 2008 14:36:51 -0700, twoj wladca <k...@vp.pl> wrote:
> > private void Form1_KeyPress(object sender, KeyPressEventArgs e)
> > {
> > if (e.KeyChar == (char)27)
> > Application.Exit();
> > }
>
> If you are going to follow this technique, Eric (and it seems from your
> other post you're not), I'd recommend handling instead the KeyDown event,
> and comparing against Keys.Escape rather than the above.
>
> Noting also, of course, that for simply closing a dialog box, calling
> Application.Exit() is probably overkill. :)
>
> Pete
No, I am not going down that road even though I appreciate people
trying to help me. But I can't help thinking that that code looks like
my very simple key handlers I wrote in pure C when doing glut-
programming. :)