My button only display image, but i want to set one shortcut key X to button for access by Alt + X (same &X...).
pls, help me - a begginer.
thanks alot!
Printable View
My button only display image, but i want to set one shortcut key X to button for access by Alt + X (same &X...).
pls, help me - a begginer.
thanks alot!
Can't you set the button's text to "&X" and set the ForeColor to Control to make the text invisible? This worked ok for me when I used the Icon property to display the icon, but not so well when I used BackgroundImage.
Does this solve the problem?
i presume this is what you wish to do...
hope it helps.:)VB Code:
[COLOR=BLUE]Private[/COLOR] [COLOR=BLUE]Sub[/COLOR] Button1_KeyDown([COLOR=BLUE]ByVal[/COLOR] sender [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Object[/COLOR], [COLOR=BLUE]ByVal[/COLOR] e [COLOR=BLUE]As[/COLOR] System.Windows.Forms.KeyEventArgs) [COLOR=BLUE]Handles[/COLOR] Button1.KeyDown [COLOR=BLUE]If[/COLOR] e.Alt = [COLOR=BLUE]True[/COLOR] [COLOR=BLUE]Then [/COLOR] [COLOR=BLUE]If[/COLOR] e.KeyCode = Keys.X [COLOR=BLUE]Then [/COLOR] MessageBox.Show(" you just pressed Alt & X") [COLOR=GREEN]'/// do your stuff to handle Alt & X here. [/COLOR] [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]If [/COLOR] [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]If [/COLOR] [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Sub[/COLOR]