Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. shortcut on text-less button

shortcut on text-less button

Scheduled Pinned Locked Moved C#
questioncss
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    troels_sorensen
    wrote on last edited by
    #1

    Hi. I've got a button with no text (only and icon) and I need a shortcut key (accelerator key) to the button. Normally i would do something like "Cl&ose" to use the "o" as a shortcut, but my button has no text, so how do i accimplish this?:|

    H 1 Reply Last reply
    0
    • T troels_sorensen

      Hi. I've got a button with no text (only and icon) and I need a shortcut key (accelerator key) to the button. Normally i would do something like "Cl&ose" to use the "o" as a shortcut, but my button has no text, so how do i accimplish this?:|

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Set KeyPreview to true on your Form that contains the button and handle the KeyDown or KeyUp event, which will give you the active modifier keys (Alt, Ctrl, and/or Shift) and the key that was pressed in a KeyEventArgs passed to the event handler.

      -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups