This documentation is archived and is not being maintained.

QueryContinueDragEventArgs.KeyState Property

Gets the current state of the SHIFT, CTRL, and ALT keys.

[Visual Basic]
Public ReadOnly Property KeyState As Integer
public int KeyState {get;}
public: __property int get_KeyState();
public function get KeyState() : int;

Property Value

The current state of the SHIFT, CTRL, and ALT keys.


The bits that are set in the KeyState property identify the keys or mouse buttons that were pressed during the operation. For example, if the left mouse button is pressed, the first bit in the KeyState property is set. You can use the bitwise AND operator to test for a given key state.

The following table lists the bits that are set for a specified event.

Bit Key
1 The left mouse button.
2 The right mouse button.
4 The SHIFT key.
8 The CTL key.
16 The middle mouse button.
32 The ALT key.

By default, the QueryContinueDrag event sets Action to DragAction.Drop if KeyState indicates that the left, middle, or right mouse button is pressed.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

QueryContinueDragEventArgs Class | QueryContinueDragEventArgs Members | System.Windows.Forms Namespace | DoDragDrop