buy now
log in

Q: How to do drag&drop from a ListView or TreeView control to the FlowChart control?

Here is the scenario: User selects a tree node in the treeview control, and then drags it over top of the flowChart control. When dragging over the FlowChart control, the drag cursor looks like a textbox. After the drop, a text box will appear in the FlowChart control.

A: You can do that by calling Control.DoDragDrop from the TreeView.MouseDown event handler, and creating the node in the DiagramView.DragDrop event. See the ListView in the Flowcharter sample project, and in one of the "miscellaneous" steps of the FCDemo example.

Q: How to prevent editing the text of some nodes when AllowInplaceEdit is enabled?

A: There is a Diagram.NodeTextEditing validation event raised when the user double-clicks a node. Set e.Cancel to true to prevent editing the text of some nodes.

Q: I have set the Behavior property of the DiagramView object to DrawLinks, but when I drag from Node to Node, I only select the two Nodes: no link is drawn. What settings should I check that could influence this behavior?

A: Check Diagram.AllowUnanchoredLinks and DiagramNode.AllowOutgoingLinks. If you have disabled the former, you can draw links only from nodes whose AnchorPattern is set.

Q: I am generating diagrams with node images, and would like the user to be able to start moving nodes with a single click. In addition, the users should not be able to create new items, not resize existing ones. Should I create a custom Behavior object for this?

A: This can be implemented by setting a few properties:

You could also implement that as a custom behavior class, where you return from the StartDraw method either 8 is the index for the movement adjustment handle, used when the Action is set to Modify. The index is ignored when the action is Create. You can assign an instance of your Behavior-derived class to the DiagramView.CustomBehavior property.

Q: I am looking for the simplest method to dynamically change the link anchor points on a node so that anchor is nearest to the connecting node. I don't want the links to cross over the source node if the destination node position changes.

A: Check how links work when their Dynamic property is enabled. It will make the links change their origin and destination connection points while dragging a node around.

Copyright © 2001-2022 MindFusion LLC. All rights reserved.
Terms of Use - Contact Us