Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p> I have modified the TreeNode.Arrange() method for indented tree arrangement.<br> Now it looks like this: </p> <pre><code>public void Arrange(Graphics gr, ref float xmin, ref float ymin) { // See how big this node is. SizeF my_size = Data.GetSize(gr, MyFont); // Recursively arrange our children, // allowing room for this node. float y = ymin + my_size.Height; float biggest_xmin = xmin + my_size.Width; float subtree_xmin = xmin + my_size.Width + Hoffset; foreach(TreeNode&lt;T&gt; child in Children) { // Arrange this child's subtree. float child_xmin = subtree_xmin; child.Arrange(gr, ref child_xmin, ref y); // See if this increases the biggest ymin value. if(biggest_xmin &lt; child_xmin) biggest_xmin = child_xmin; // Allow room before the next sibling. y += Voffset; } // Remove the spacing after the last child. if(Children.Count &gt; 0) y -= Voffset; // See if this node is wider than the subtree under it. float subtree_height = y - ymin; if(my_size.Height &gt; subtree_height) { y = ymin + (my_size.Height - subtree_height) / 2; foreach(TreeNode&lt;T&gt; child in Children) { // Arrange this child's subtree. child.Arrange(gr, ref subtree_xmin, ref y); y += Voffset; } subtree_height = my_size.Height; } // Set this node's center position. Center = new PointF(xmin + my_size.Width / 2, ymin + my_size.Height / 2); ymin += subtree_height; xmin = biggest_xmin; } </code></pre> <p>Note, that the DrawSubtreLinks() method have also been modified:</p> <pre><code>private void DrawSubtreeLinks(Graphics gr) { foreach(TreeNode&lt;T&gt; child in Children) { PointF p = new PointF(Center.X, child.Center.Y); gr.DrawLine(MyPen, Center, p); gr.DrawLine(MyPen, p, child.Center); child.DrawSubtreeLinks(gr); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload