|
-
Aug 20th, 2003, 01:50 AM
#1
Thread Starter
New Member
How to set shortcut key to a image button?
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!
-
Aug 20th, 2003, 04:00 AM
#2
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?
This world is not my home. I'm just passing through.
-
Aug 20th, 2003, 05:25 AM
#3
i presume this is what you wish to do...
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]
hope it helps.
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|