Key press

  • Thread starter Thread starter Alan T
  • Start date Start date
A

Alan T

I want to detect if the "Control" key is pressed when I selected items on a
listview and drag these listview items?
 
Maybe you can register listview KeyPress or KeyDown event to detect
whether Control key is pressed.
 
Hi Alan,

Use the static Control.ModifierKeys to determine if control keys are down
at any given time.

if(Control.ModifierKeys == Keys.Control) // only the CTRL key is pressed

if(( Control.ModifierKeys & Keys.Control) != 0) // CTRL key is pressed,
though ALT or SHIFT may be pressed as well
 
Thanks.
What I am going to do is to test at the dragdrop event, if the user press
CTRL key, how about this:
if ((e.KeyState & 8) == 8)


Hi Alan,

Use the static Control.ModifierKeys to determine if control keys are down
at any given time.

if(Control.ModifierKeys == Keys.Control) // only the CTRL key is pressed

if(( Control.ModifierKeys & Keys.Control) != 0) // CTRL key is pressed,
though ALT or SHIFT may be pressed as well
 
That should work.


Thanks.
What I am going to do is to test at the dragdrop event, if the user press
CTRL key, how about this:
if ((e.KeyState & 8) == 8)


Hi Alan,

Use the static Control.ModifierKeys to determine if control keys are down
at any given time.

if(Control.ModifierKeys == Keys.Control) // only the CTRL key is pressed

if(( Control.ModifierKeys & Keys.Control) != 0) // CTRL key is pressed,
though ALT or SHIFT may be pressed as well
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top