468,283 Members | 2,036 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,283 developers. It's quick & easy.

Disable Mouse Click Event

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
2 3231
SammyB
807 Expert 512MB
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
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.

Similar topics

1 post views Thread by yair | last post: by
6 posts views Thread by nntp | last post: by
9 posts views Thread by Armando | last post: by
2 posts views Thread by bartlomiej.szafraniec | last post: by
4 posts views Thread by Seen | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.