internal void OnNodeChanged(object sender, NodeEventArgsType e, object oParam) { object obj2 = oParam; Node r = (Node)sender; NodeTemplate template = this.GetTemplate(r); switch (e) { case NodeEventArgsType.Selection: if (!((bool)oParam)) { this.SetSelected(null); return; } this.SetSelected(r); return; case NodeEventArgsType.TemplateIndex: { int offset = 0; NodeTemplate template2 = this.GetTemplate(r, (int)oParam); offset -= template2.GetHeight(r); r.ResetCachedBounds(null); offset += template.GetHeight(r); this.OnChanged(base.List.IndexOf(r), new TreeResizeEventArgs(offset)); return; } case NodeEventArgsType.BeforeExpand: this.OnChanged(this, new TreeChangedEventArgs(TreeEventArgsType.BeforeExpand, oParam)); return; case NodeEventArgsType.AfterExpand: this.OnChanged(this, new TreeRefreshEventArgs(true)); this.OnChanged(this, new TreeChangedEventArgs(TreeEventArgsType.AfterExpand, oParam)); return; case NodeEventArgsType.BeforeCollapse: this.OnChanged(this, new TreeChangedEventArgs(TreeEventArgsType.BeforeCollapse, oParam)); return; case NodeEventArgsType.AfterCollapse: this.OnChanged(this, new TreeRefreshEventArgs(true)); this.OnChanged(this, new TreeChangedEventArgs(TreeEventArgsType.AfterCollapse, oParam)); return; } if ((template != null) && template.AutoHeight) { int actualHeight = r.ActualHeight; r.ResetCachedBounds(null); int height = template.GetHeight(r); if (height != actualHeight) { this.OnChanged(base.List.IndexOf(r), new TreeResizeEventArgs(height - actualHeight)); return; } } this.OnChanged(base.List.IndexOf(sender), new TreeChangedEventArgs(TreeEventArgsType.NodeChange, obj2)); }
internal int Draw(Graphics gr, TemplateSet ts, int width, int ymax, int ymin, int iNode, int iNodeOffset, ref bool resetScrollbar) { int yOffset = iNodeOffset; int count = base.List.Count; this.LastDrawnNodeOffset = yOffset; this.LastDrawnNode = iNode; while (this.LastDrawnNode < count) { Node node = null; if ((this.LastDrawnNode >= 0) && (this.LastDrawnNode < base.InnerList.Count)) { node = base.InnerList[this.LastDrawnNode] as Node; } if (node != null) { NodeTemplate template = node.GetTemplate(ts); int height = 0; int num4 = -1; int xOffset = node.Level * this.m_AdvancedTree.NodeIndent; if (template.CustomizeCells(node)) { num4 = template.GetHeight(node); node.ResetCachedBounds(null); } height = template.GetHeight(node); if ((num4 >= 0) && (height != num4)) { resetScrollbar = true; } if ((yOffset + height) >= ymin) { template.Draw(gr, xOffset, yOffset, node, width, -1); } this.LastDrawnNodeOffset = yOffset; yOffset += height; if (this.AdvancedTree.GridLines) { if (yOffset >= 0) { gr.DrawLine(this.m_AdvancedTree.m_penBorder, 0, yOffset, this.AdvancedTree.Width, yOffset); } yOffset++; } if (node.IsExpanded) { yOffset = node.Nodes.Draw(gr, ts, width, ymax, ymin, 0, yOffset, ref resetScrollbar); } if (yOffset > ymax) { return(yOffset); } } this.LastDrawnNode++; } this.LastDrawnNodeOffset = yOffset; return(yOffset); }