When I first press down control key (the left one) and then click the left mouse button, why does the following code gets executed. I am modifying existing code and the below code is already there. I guess no one has tried it before, with control key pressed, it has only been used with left-mouse-clicked and it has always worked for that case. But I want a different code executed when the mouse left key is pressed at the same time that the control key is pressed.
private void treeList1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
TreeList tree = sender as TreeList;
if (e.Button == MouseButtons.Right && ModifierKeys == Keys.None && tree.State == TreeListState.Regular)
{
//the code that is here gets executed
MessageBox.Show("I am here");
}
}
I would highly appreciate any hint or help.
P.S. I would like to add that in the above case when I inspect e.button value it shows that is equal to Right although I pressed the left mouse button and the Ctrl Key. That is a mystery to me.
Dear StackOverflow fellows :I found the problem, since I am using a VM on a MAC I had to disable some Key Mapping on my Virtual Machine preference and now my original code works. Thanks for all your help.