Пример #1
0
        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;
        }
Пример #2
0
 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);
 }
Пример #3
0
 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;
 }
Пример #4
0
 public TreeColumnEventArgs(TreeColumn column)
 {
     _column = column;
 }
Пример #5
0
 public ResizeColumnState(TreeViewAdv tree, TreeColumn column, Point p)
     : base(tree, column)
 {
     _initLocation = p;
     _initWidth = column.Width;
 }
Пример #6
0
 internal void OnColumnReordered(TreeColumn column)
 {
     if (ColumnReordered != null)
         ColumnReordered(this, new TreeColumnEventArgs(column));
 }
Пример #7
0
 internal void OnColumnWidthChanged(TreeColumn column)
 {
     if (ColumnWidthChanged != null)
         ColumnWidthChanged(this, new TreeColumnEventArgs(column));
 }
Пример #8
0
 internal void ChangeColumnWidth(TreeColumn column)
 {
     if (!(_input is ResizeColumnState))
     {
         FullUpdate();
         OnColumnWidthChanged(column);
     }
 }
Пример #9
0
 private void UpdateToolTip(MouseEventArgs e)
 {
     TreeColumn col = GetColumnAt(e.Location);
     if (col != null)
     {
         if (col != _tooltipColumn)
             SetTooltip(col.TooltipText);
     }
     else
         DisplayNodesTooltip(e);
     _tooltipColumn = col;
 }
Пример #10
0
 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;
 }
Пример #11
0
 public ColumnState(TreeViewAdv tree, TreeColumn column)
     : base(tree)
 {
     _column = column;
 }
Пример #12
0
 public ClickColumnState(TreeViewAdv tree, TreeColumn column, Point location)
     : base(tree, column)
 {
     _location = location;
 }