Click here to Skip to main content
15,902,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<2>
Thanks for first answer of my question. However, there is no bool called 'handled' in mouseup event, so I still can not intercept the mouse up event, and the default behavior is still be done.

To design a specific draw object is too complicated to me, so, I am still waiting for any saimple solution for this. Thanks.

<1>
I design a window application, my question is below :

1. There is one treeview object.
2. When click on one node, the default way is that this node will be
changed its backcolor to be blue.
3. Now, I would like to have my specific function when mouse click on
the node, and would not expect the backcolor of this node is changed
to be blue, so I create an event handler :
treeview1.mouseup += new MouseEventHandler(treeview1_MouseUp);
4. And thre are my specific statements in the event handler.

Now, the condition is that after the treeview mouseup event is
executed, the backcolor of the node is still changed to be blue, my question is "How can I intercept the mouse up event, and do not pass it
to system for further process" ?
Posted
Updated 22-Jul-10 19:40pm
v2

1 solution

If the eventargs passed in has a bool called 'handled', you can turn it to true. This does not guarentee that the default behaviour your describe will not occur, you may have to create an owner drawn control for that, or perhaps you could explicitly set the color in your event handler, if it's been set before your handler is called.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900