Results 1 to 3 of 3

Thread: How to set shortcut key to a image button?

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2003
    Posts
    3

    Question 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!

  2. #2
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    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.

  3. #3
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    i presume this is what you wish to do...
    VB Code:
    1. [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
    2.         [COLOR=BLUE]If[/COLOR] e.Alt = [COLOR=BLUE]True[/COLOR] [COLOR=BLUE]Then
    3. [/COLOR]            [COLOR=BLUE]If[/COLOR] e.KeyCode = Keys.X [COLOR=BLUE]Then
    4. [/COLOR]                MessageBox.Show(" you just pressed Alt & X")
    5.                 [COLOR=GREEN]'/// do your stuff to handle Alt & X here.
    6. [/COLOR]            [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]If
    7. [/COLOR]        [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]If
    8. [/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
  •  



Click Here to Expand Forum to Full Width