Hi,
"NodeMouseClick" in Ultra Tree View for getting the Context menu strip.
M.
mansi,
You can use the contextmenu property of the tree itself if all you want to do is show a context menu for a right click on a node. If you are using columns in the tree (e.g., OutlookExpress style), you can set up a context menu for the editor control assigned to the column.
As far as working with a nodemouseclick, in a Tree_MouseDown event handler you can use a hittest as in this code:
Dim hittestnode As UltraTreeNode = Me.MyTree.GetNodeFromPoint(Me.MyTree.PointToClient(Me.MousePosition)) If hittestnode Is Nothing Then Exit Sub
' Check for right click to get contextmenu If e.Button = MouseButtons.Right Then Exit Sub
' Get reference to cell under mouse position Dim cell As UltraTreeNodeCell = CellFromPoint(Me.MyTree, Me.MousePosition) If cell Is Nothing Then Exit Sub
Etc.
Hope this helps,
JC
I recommend using MouseUp rather than MouseDown. I think if you experiment with other applications you will find that context menus are always shown on MouseUp, not MouseDown. Using MouseDown can cause problems with mouse messages because the context menu eats the MouseUp and some controls will get confused when they get a MouseDown with no MouseUp.