public void AutoSizeColumn(TreeColumn column) { if (!Columns.Contains(column)) { throw new ArgumentException("column"); } DrawContext context = new DrawContext(); context.Graphics = Graphics.FromImage(new Bitmap(1, 1)); context.Font = this.Font; int res = 0; for (int row = 0; row < RowCount; row++) { if (row < RowMap.Count) { int w = 0; TreeNodeAdv node = RowMap[row]; foreach (NodeControl nc in NodeControls) { if (nc.ParentColumn == column) { //w += nc.GetActualSize(node, _measureContext).Width; w += nc.GetActualSize(node, context).Width; } } res = Math.Max(res, w); } } if (res > 0) { column.Width = res; } }
public ResizeColumnState(TreeViewAdv tree, TreeColumn column, Point p) : base(tree, column) { _initLocation = p; _initWidth = column.Width; }
public ClickColumnState(TreeViewAdv tree, TreeColumn column, Point location) : base(tree, column) { _location = location; }
public ColumnState(TreeViewAdv tree, TreeColumn column) : base(tree) { _column = column; }
public TreeColumnEventArgs(TreeColumn column) { _column = column; }