DragEventArgs.Keystate

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am doing a drag-drop in a treeview. In the DragOver and DragDrop event
handlers, I check the KeyState (e.KeyState) to see if CTRL is pressed. When
I hold the CTRL key down, e.KeyState in the DragOver event handler = 9, and
in the DragDrop event handler it = 8. According to the documentation, it
should = 8. Does anyone know why it is 9 in DragOver?
 
Nathan,

Because you hold the left mouse button down during dragging.

The number in the KeyState is bitwise OR of the possible bits you when you
drag hodling down the Ctrl key you have

the bit for the Ctrl set, which is numerically 8 and the bit for the left
mouse button bit, which is numerically 1

8 | 1 = 9
 
Ah, that makes sense. Thanks.

Stoitcho Goutsev (100) said:
Nathan,

Because you hold the left mouse button down during dragging.

The number in the KeyState is bitwise OR of the possible bits you when you
drag hodling down the Ctrl key you have

the bit for the Ctrl set, which is numerically 8 and the bit for the left
mouse button bit, which is numerically 1

8 | 1 = 9
 
Back
Top