Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to add Accelerator key in winform

11 views
Skip to first unread message

David Wang

unread,
Apr 8, 2002, 1:49:37 PM4/8/02
to
Hi,
How to add accelerator key(like f1, f2,...) combine to the button in
Winform? Thanks a lot!

David


Charles Petzold

unread,
Apr 8, 2002, 3:14:19 PM4/8/02
to
Accelerator keys are called "shortcuts" in Windows Forms. You assign a
shortcut to a MenuItem by setting the Shortcut property to a member of the
Shortcut enumeration (like Shortcut.F1, Shortcut.F2, ...) The shortcut is
automatically added to the text of the menu item.

If you want a shortcut that is *not* associated with a menu item, create a
MenuItem anyway, add it to your menu, but set the Visible property of the
MenuItem to false.

I discuss shortcuts on pages 653-655 of my book "Programming Windows With
C#".

Charles Petzold
www.charlespetzold.com


"David Wang" <wt0...@sina.com.cn> wrote in message
news:#K5llTy3BHA.2260@tkmsftngp02...

AnilSharma

unread,
Apr 8, 2002, 3:44:41 PM4/8/02
to
Sir,

I always get thrilled whenever I see "Charles Petzold" name here in this
newsgroup. I started knowing win programing only after reading your book.
Thanks :)

- Anil Sharma

"Charles Petzold" <cha...@charlespetzold.com> wrote in message
news:f_ls8.109309$in3.29...@typhoon.nyc.rr.com...

0 new messages