"=?Utf-8?B?TXJOb2JvZHk =?=" <Mr******@discu ssions.microsof t.com>
wrote in news:3A******** *************** ***********@mic rosoft.com:
Say I want to do a specific action if the user holds down the
CTRL key while clicking something in my UI- how can I determine
if this key is currently pressed within the mouse event?
One way would be to use three events (OnKeyDown, OnKeyUp, and
OnMouse*), and a boolean class-wide variable.
Here's some pseudocode:
// Class-wide variable
private bool isControlKeyPre ssed = false;
OnKeyDown event:
if control key is pressed:
this.isControlK eyPressed = true;
OnKeyUp event:
if control key is being released:
this.isControlK eyPressed = false;
OnMouse* event (where * = enter, leave, move, etc...):
if this.isControlK eyPressed:
// do control key-related processing here.
--
Hope this helps.
Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/