private void AddNewNode(TreeNodeAdv parent, object tag, int index) { TreeNodeAdv node = new TreeNodeAdv(this, tag); AddNode(parent, index, node); }
internal void ReadChilds(TreeNodeAdv parentNode) { ReadChilds(parentNode, false); }
internal Rectangle GetNodeBounds(TreeNodeAdv node) { return(GetNodeBounds(GetNodeControls(node))); }
internal IEnumerable <NodeControlInfo> GetNodeControls(TreeNodeAdv node, Rectangle rowRect) { if (node == null) { yield break; } int y = rowRect.Y; int x = (node.Level - 1) * _indent + LeftMargin; int width = 0; Rectangle rect = Rectangle.Empty; if (ShowPlusMinus) { width = _plusMinus.GetActualSize(node, _measureContext).Width; rect = new Rectangle(x, y, width, rowRect.Height); if (UseColumns && Columns.Count > 0 && Columns[0].Width < rect.Right) { rect.Width = Columns[0].Width - x; } yield return(new NodeControlInfo(_plusMinus, rect, node)); x += width; } if (!UseColumns) { foreach (NodeControl c in NodeControls) { Size s = c.GetActualSize(node, _measureContext); if (!s.IsEmpty) { width = s.Width; rect = new Rectangle(x, y, width, rowRect.Height); x += rect.Width; yield return(new NodeControlInfo(c, rect, node)); } } } else { int right = 0; foreach (TreeColumn col in Columns) { if (col.IsVisible && col.Width > 0) { right += col.Width; for (int i = 0; i < NodeControls.Count; i++) { NodeControl nc = NodeControls[i]; if (nc.ParentColumn == col) { Size s = nc.GetActualSize(node, _measureContext); if (!s.IsEmpty) { bool isLastControl = true; for (int k = i + 1; k < NodeControls.Count; k++) { if (NodeControls[k].ParentColumn == col) { isLastControl = false; break; } } width = right - x; if (!isLastControl) { width = s.Width; } int maxWidth = Math.Max(0, right - x); rect = new Rectangle(x, y, Math.Min(maxWidth, width), rowRect.Height); x += width; yield return(new NodeControlInfo(nc, rect, node)); } } } x = right; } } } }
private void AddExpandingNode(TreeNodeAdv node) { node.IsExpandingNow = true; _expandingNodes.Add(node); ExpandingIcon.Start(); }