• 0

[C#] Alt Key and Control Key


Question

Sup guys...

I posted before a question regarding ProcessCmdKey (How to catch Shift+Alt+Key, i changed that for Shift+Alt+Up btw) that works fine, I do it this way:

if ((Keys.Up | Keys.Shift | Keys.Alt) == keyData)
               /* Does whatever*/

So far so good, let's say I want to do it with Control+Alt+Up, I'd say it should go:

if ((Keys.Up | Keys.Control | Keys.Alt) == keyData)
               /* Does whatever*/

Now, when I put Alt+Control together it doesn't seem to work, it won't go into the If :wacko: , seems to go into a conflict when I try Alt+Control together :pinch:

Anyone knows about this? Thanks :p

Link to comment
https://www.neowin.net/forum/topic/264309-c-alt-key-and-control-key/
Share on other sites

10 answers to this question

Recommended Posts

  • 0

have you tried using Keys.ControlKey instead of Keys.Control ? The MSDN documentation calls Keys.Control "the CTRL modifier key" and Keys.ControlKey "the CTRL key" - does that make a difference in using these things?

(i notice its the same with the Alt key, except its Keys.Alt and Keys.Menu for those two...)

this is just a stab in the dark, however, trying to give you some direction.

  • 0

Uhmm you know what?

It's the Up arrow the one it's getting in the way, if i do:

if ((Keys.E | Keys.Control | Keys.Alt | Keys.Shift) == keyData)

It works, but, if i do

if ((Keys.Up | Keys.Control | Keys.Alt | Keys.Shift) == keyData)

It doesn't :pinch:

I'm using a control named Tlist BTW, any one heard about it ?

  • 0

I suspect the problem is that you are using a listControl, which normally would intercept the up key. The way ProcessCmdKey works is it passes the message down the chain of controls until someone uses it. So I THINK the control is intercepting the up key before you can. :)

Dan

  • 0
  dannyres said:
I suspect the problem is that you are using a listControl, which normally would intercept the up key.  The way ProcessCmdKey works is it passes the message down the chain of controls until someone uses it.  So I THINK the control is intercepting the up key before you can.  :)

Dan

585199358[/snapback]

Yes - that makes sense :yes:

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.