Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4165
Drag and Drop in the Same Tree - How to Highlight Node When Dragging?
posted

Hello,

I have setup a drag/drop operation of nodes in a WinTree. I am having two issues.

The first is, if I click on the and try to start dragging, it is kind of hit or miss. If I click on the node, then click again it will drag every time. Do I have to add code to the mousedown event to set the active node?

Issue 2 is that once I start dragging as I pass the node over other nodes, those other Nodes do not highlight so the user has no real input as to where he is dropping the node. In a regular .net TreeView this works by the following code.

 

 System.Drawing.Point pn = utvDocPage.PointToClient(new System.Drawing.Point(e.X, e.Y));
            TreeNode tn = utvDocPage.GetNodeAt(pn);
            utvDocPage.Focus();
            utvDocPage.SelectedNode = tn;

I tried to mimic this in the WinTree with no luck.

How can I accomplish this?

Thanks.

 

  • 69832
    Suggested Answer
    Offline posted

    You should probably take a look at the 'UltraTree Drag and Drop' sample which is included with the SDK; it demonstrates a solution to this problem using the IUIElementDrawFilter interface.