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. Catching key events to a panel?

Catching key events to a panel?

Scheduled Pinned Locked Moved C#
question
4 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.
  • M Offline
    M Offline
    misterbear
    wrote on last edited by
    #1

    Hello, I'm writing a small application in which a draw onto a panel and want to control the painting on the panel with the arrow keys (think of it as a painting program with the keys instead of mouse if you wish..) Now the thing is, from what I figure the Panel can't gain keyboard focus. So I would need some other way to retrieve the key events. What do I do? Place a dummy control somewher, hide it, give it keyb. focus and then reacts on the events from there? A better solution? If so please tell me the 'right' way to do it.. /Bjorn

    K 1 Reply Last reply
    0
    • M misterbear

      Hello, I'm writing a small application in which a draw onto a panel and want to control the painting on the panel with the arrow keys (think of it as a painting program with the keys instead of mouse if you wish..) Now the thing is, from what I figure the Panel can't gain keyboard focus. So I would need some other way to retrieve the key events. What do I do? Place a dummy control somewher, hide it, give it keyb. focus and then reacts on the events from there? A better solution? If so please tell me the 'right' way to do it.. /Bjorn

      K Offline
      K Offline
      Karl 2000
      wrote on last edited by
      #2

      Is it possible for you to use a UserControl rather than a panel? That would solve your keyboard input problem. Karl Baum CEO of KGB Technologies Specializing in custom software development.

      M 1 Reply Last reply
      0
      • K Karl 2000

        Is it possible for you to use a UserControl rather than a panel? That would solve your keyboard input problem. Karl Baum CEO of KGB Technologies Specializing in custom software development.

        M Offline
        M Offline
        misterbear
        wrote on last edited by
        #3

        Yes it's most certainly possible, thanks for the suggestion. But just out of interest, would there be a way to do it even with a panel control? And if so, how?

        K 1 Reply Last reply
        0
        • M misterbear

          Yes it's most certainly possible, thanks for the suggestion. But just out of interest, would there be a way to do it even with a panel control? And if so, how?

          K Offline
          K Offline
          Karl 2000
          wrote on last edited by
          #4

          The only thing I can think of is to have the form that the panel is on receive the keyboard events. Then it could call functions that cause your panel to do appropriate things. Karl Baum CEO of KGB Technologies Specializing in custom software development.

          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