Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic DragDrop in Treeview (Read 2424 times)
Lonnie Nunweiler
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Feb 26th, 2018
DragDrop in Treeview
Feb 26th, 2018 at 9:12pm
Print Post  
I am evaluating the Diagramming tools for winforms.  So far it looks very complete and easy to use.

However, I need to be able to drag and drop from a BufferedTreeView which is used in the DockControl sample for the directory display.

There does not seem to be a DragDropEnabled property.  What am I missing or is the control missing dragdrop?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: DragDrop in Treeview
Reply #1 - Feb 27th, 2018 at 6:56am
Print Post  
There's a DiagramView.AllowDrop property inherited from base Control class, and also DragOver and DragDrop events. These are shown in WorkflowDesigner sample project. You can convert from drag-and-drop screen coordinates to diagram's MeasureUnit ones like this -

Code
Select All
// DragEventArgs gives us the screen coordinates of a point
// so convert them to the diagram logical coordinate system
Point clientPoint = view.PointToClient(new Point(e.X, e.Y));
PointF diagramPoint = view.ClientToDoc(clientPoint);
 



and then e.g. create new nodes at that location or look for existing ones there.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: DragDrop in Treeview
Reply #2 - Feb 27th, 2018 at 8:25am
Print Post  
I see now the BufferedTreeView control you are referring to is a subclass of TreeView in our sample project. You can use standard drag-and-drop methods again to start dragging from it, e.g. handle MouseDown, call TreeNode node = tree.GetNodeAt(e.X, e.Y); to find element at mouse position and then tree.DoDragDrop(...) to initiate the operation. For example see http://www.java2s.com/Code/CSharp/GUI-Windows-Form/DraganddropTreeNode.htm

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Lonnie Nunweiler
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Feb 26th, 2018
Re: DragDrop in Treeview
Reply #3 - Mar 17th, 2018 at 5:46am
Print Post  
I did finally purchase a license, and do not regret it at all.

I also discovered that the BufferedTreeView is only a simple subclass of the standard .net Treeview. I can easily get drag and drop going, but I really need Multiple Select, which I have code for, so no problem ..... unless you have another way to build an Explorer style Directory Tree. Grin
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: DragDrop in Treeview
Reply #4 - Mar 19th, 2018 at 9:40am
Print Post  
Hi,

There's the Microsoft.VisualBasic.Compatibility.VB6.DirListBox included in .NET if you'll actually be displaying a directory tree. You could also build diagrams for directory trees, e.g. as in DirTree and TreeMap sample projects, or radial layout step in the demo Wink

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint