i modified flowchart.net tree layout sample a bit.
i am inserting my objects from database
my project is a bit diffrent because each item can have more than one parent.
this is a sample of links table in my database
item1 item2
-----------------
0 1
0 2
0 3
1 4
1 5
4 5
4 2
I use this code to link them to eachother
Box b = addChild(fc.FindBox(deviceid), r.id, title);
This is my addchild function which checks if something is inserted below and links it to appropriate box
private Box addChild(Box node,int id, string title)
{
// get the group of the parent node
Box childNode = fc.FindBox(id);
bool newnode = false;
if (childNode == null) {
childNode = fc.CreateBox(0, 0, 30, 20);
newnode = true;
}
else childNode = fc.FindBox(id);
int tag = 0;
if (node != null) tag = (int)node.Tag;
if (newnode)
{
Group prntGroup = fc.FindGroup(tag);
if (node != null)
prntGroup.AttachToArrowPoint(childNode, 10);
}
if (node != null) fc.CreateArrow(node, childNode);
childNode.Tag =id ;
// link the parent node with the child
// start a new group to which node children will be added
if(newnode)
{
Group group = fc.CreateGroup(childNode);
group.Tag = id;
}
rearrange();
childNode.Text = title;
return childNode;
}
It places great big distances between my items. how can i avoid them? how can i make my autoarrowed diagram more compact to fit in a few papers? thank you
----------------
My other question is this.
when my diagram is about 100 page, the canvas ends in some point and i cant see the last item (it expands if i resize something until there but it is hard and annoying to do this many times)
how can i resize my canvas to show all controls in it?