internal virtual void AddNode(TreeListNode node) { Add(Nodes, node); }
internal void Add(TreeNodeCollection parent, TreeListNode node) { if (!_useCompareTo) { parent.Add(node); return; } /* Console.WriteLine("AddSorted: " + node); Console.WriteLine("Current nodes: "); for (int j = 0; j < parent.Count; j++) Console.WriteLine(" " + parent[j]); */ int i; for (i = parent.Count - 1; i >= 0; i--) { TreeListNode lookNode = (TreeListNode)parent[i]; // Console.WriteLine("looking at: " + lookNode // + " (" + i + ")"); if (lookNode.CompareTo(node) <= 0) break; } parent.Insert(i + 1, node); }
internal void HandleColumnsDrawing(TreeListNode tlNode, NMCUSTOMDRAW cd) { RECT newRect = cd.rc; // Make text align correctly - seems to be off a pixel newRect.top += 1; using (Graphics g = Graphics.FromHdc(cd.hdc)) { // Do each of the columns defined for the tree for (int i = 0; i < _treeView.Columns.Count; i++) { newRect.left = cd.rc.left + ((Splitter)_columnHeaderSplitters[i]).Bounds.X - _scrollPos; Object colData = tlNode.ColumnData[i]; if (i == 0) { // Clear out the data for the column (first time) g.FillRectangle(SystemBrushes.Window, newRect.left - PIXEL_PADDING, cd.rc.top, cd.rc.right, cd.rc.bottom); } // Vertical line to separate the columns g.DrawLine(_greyPen, newRect.left, cd.rc.top, newRect.left, cd.rc.bottom); // Write the actual text if (colData != null) { // Start the text one pixel after the line newRect.left += PIXEL_PADDING; g.DrawString(colData.ToString(), _treeView.Font, SystemBrushes.ControlText, newRect.left, newRect.top); } } // Draw the horizontal grid lines g.DrawLine(_greyPen, cd.rc.left, cd.rc.top, cd.rc.right, cd.rc.top); g.DrawLine(_greyPen, cd.rc.left, cd.rc.bottom, cd.rc.right, cd.rc.bottom); } }