By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,925 Members | 727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,925 IT Pros & Developers. It's quick & easy.

Disable Mouse Click Event

P: 14
Hi,

i am new to C#,

i have a multiselection treeview, where if i select a nodes with ctrl and shift corresponding nodes will be copied to another treenode,

i want to unselect the childnode selection with ctrl and shift if parent node is selected.

i think of disablin the mouse click event inside that treenode if parent node is selected?
Expand|Select|Wrap|Line Numbers
  1. private void treeViewMS1_AfterSelect(object sender, TreeViewEventArgs e)
  2. {
  3.     MyKeyEvent kEv = new MyKeyEvent();
  4.     bool kControl2 = (ModifierKeys == Keys.Control);
  5.     bool kShift2 = (ModifierKeys == Keys.Shift);
  6.     bool mClick = (MouseButtons == MouseButtons.Left);
  7.     // bool parent =IsP
  8.     if (e.Node.Text == "WeldDataFile")
  9.     {
  10.         if ((kControl2) && (mClick))
  11.         {
  12.             // OnKeyAction(this, kEv); 
  13.             //Here i have to disable mouse event till i copy that selected node to another treeview
  14.         }
  15.         else if ((kShift2) && (mClick))
  16.         {
  17.             //OnKeyAction(this, kEv);
  18.             //Here i have to disable mouse event till i copy that selected node to another treeview
  19.         }
  20.     }
  21. }
  22.  
Can anybody plz help me in this regards, its urgent
Feb 29 '08 #1
Share this Question
Share on Google+
2 Replies


SammyB
Expert 100+
P: 807
The easy way is to have a class-level variable that is set to true while you copy the node. Then you just check that variable in other events. The fancy way is to filter out the mouse messages before they reach the controls. If you google for IMessageFilter and mouse, you will find code examples. HTH --Sam
Feb 29 '08 #2

P: 14
The easy way is to have a class-level variable that is set to true while you copy the node. Then you just check that variable in other events. The fancy way is to filter out the mouse messages before they reach the controls. If you google for IMessageFilter and mouse, you will find code examples. HTH --Sam

i used IMessage filter interface but mouse is disabled in the whole application, but i want it only inside treeview
how come it is possible?
Mar 13 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.