1 100 Dec 17, 2003 #2 Hi JezB In MouseDown handler check the Control.ModifierKeys static property here you can find the states of ALT, CTRL and SHIFT keys. HTH B\rgds 100
Hi JezB In MouseDown handler check the Control.ModifierKeys static property here you can find the states of ALT, CTRL and SHIFT keys. HTH B\rgds 100
S Saurabh Dec 17, 2003 #4 You mean something like, if ((ModifierKeys & Keys.Control) == Keys.Control) //check if Ctrl key was pressed, note bitwise & cheers!! --Saurabh
You mean something like, if ((ModifierKeys & Keys.Control) == Keys.Control) //check if Ctrl key was pressed, note bitwise & cheers!! --Saurabh
N n! Dec 17, 2003 #5 How can this be done ? There's no Keys attribute in MouseEventArgs. System.Windows.Forms.Control has a static 'ModifierKeys' property you can access: e.g. using System.Windows.Forms; .... if ( Control.ModifierKeys == Keys.Control ) { // CTRL key was pressed (and no other modifier) } .... n!
How can this be done ? There's no Keys attribute in MouseEventArgs. System.Windows.Forms.Control has a static 'ModifierKeys' property you can access: e.g. using System.Windows.Forms; .... if ( Control.ModifierKeys == Keys.Control ) { // CTRL key was pressed (and no other modifier) } .... n!
T Tim Wilson [MVP] Dec 17, 2003 #6 Use the static ModifierKeys property of the Control class: if (Control.ModifierKeys == Keys.Control) { // then the Ctrl key is down. }
Use the static ModifierKeys property of the Control class: if (Control.ModifierKeys == Keys.Control) { // then the Ctrl key is down. }
J JezB Dec 17, 2003 #7 Typical !! Loads of people answer when you find the answer yourself - when you are really stuck no-one gives a solution !! hehe
Typical !! Loads of people answer when you find the answer yourself - when you are really stuck no-one gives a solution !! hehe
H Herfried K. Wagner [MVP] Dec 17, 2003 #9 * "Tim Wilson said: Use the static ModifierKeys property of the Control class: if (Control.ModifierKeys == Keys.Control) { // then the Ctrl key is down. } Click to expand... If you want to check if the control key is down even when other modifier keys are down, use this code: \\\ If Control.ModifierKeys And Keys.Control Then ... End If ///
* "Tim Wilson said: Use the static ModifierKeys property of the Control class: if (Control.ModifierKeys == Keys.Control) { // then the Ctrl key is down. } Click to expand... If you want to check if the control key is down even when other modifier keys are down, use this code: \\\ If Control.ModifierKeys And Keys.Control Then ... End If ///