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; } res = Math.Max(res, w); } } if (res > 0) column.Width = res; }
public ReorderColumnState(TreeViewAdv tree, TreeColumn column, Point initialMouseLocation) : base(tree, column) { _location = new Point(initialMouseLocation.X + Tree.OffsetX, 0); _dragOffset = tree.GetColumnX(column) - initialMouseLocation.X; _ghostImage = column.CreateGhostImage(new Rectangle(0, 0, column.Width, tree.ColumnHeaderHeight), tree.Font); }
public override bool MouseMove(MouseEventArgs args) { _dropColumn = null; _location = new Point(args.X + Tree.OffsetX, 0); int x = 0; foreach (TreeColumn c in Tree.Columns) { if (c.IsVisible) { if (_location.X < x + c.Width / 2) { _dropColumn = c; break; } x += c.Width; } } Tree.UpdateHeaders(); return true; }
public TreeColumnEventArgs(TreeColumn column) { _column = column; }
public ResizeColumnState(TreeViewAdv tree, TreeColumn column, Point p) : base(tree, column) { _initLocation = p; _initWidth = column.Width; }
internal void OnColumnReordered(TreeColumn column) { if (ColumnReordered != null) ColumnReordered(this, new TreeColumnEventArgs(column)); }
internal void OnColumnWidthChanged(TreeColumn column) { if (ColumnWidthChanged != null) ColumnWidthChanged(this, new TreeColumnEventArgs(column)); }
internal void ChangeColumnWidth(TreeColumn column) { if (!(_input is ResizeColumnState)) { FullUpdate(); OnColumnWidthChanged(column); } }
private void UpdateToolTip(MouseEventArgs e) { TreeColumn col = GetColumnAt(e.Location); if (col != null) { if (col != _tooltipColumn) SetTooltip(col.TooltipText); } else DisplayNodesTooltip(e); _tooltipColumn = col; }
internal int GetColumnX(TreeColumn column) { int x = -OffsetX; foreach (TreeColumn col in Columns) { if (col.IsVisible) { if (column == col) return x; else x += col.Width; } } return x; }
public ColumnState(TreeViewAdv tree, TreeColumn column) : base(tree) { _column = column; }
public ClickColumnState(TreeViewAdv tree, TreeColumn column, Point location) : base(tree, column) { _location = location; }