Ejemplo n.º 1
0
 public TreeViewRowDrawEventArgs(Graphics graphics, Rectangle clipRectangle, TreeNodeAdv node, DrawContext context, int row, Rectangle rowRect)
     : base(graphics, clipRectangle)
 {
     _node    = node;
     _context = context;
     _row     = row;
     _rowRect = rowRect;
 }
Ejemplo n.º 2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            BeginPerformanceCount();
            PerformanceAnalyzer.Start("OnPaint");

            DrawContext context = new DrawContext();

            context.Graphics = e.Graphics;
            context.Font     = this.Font;
            context.Enabled  = Enabled;

            int y          = 0;
            int gridHeight = 0;

            if (UseColumns)
            {
                DrawColumnHeaders(e.Graphics);
                y += ColumnHeaderHeight;
                if (Columns.Count == 0 || e.ClipRectangle.Height <= y)
                {
                    return;
                }
            }

            int firstRowY = _rowLayout.GetRowBounds(FirstVisibleRow).Y;

            y -= firstRowY;

            e.Graphics.ResetTransform();
            e.Graphics.TranslateTransform(-OffsetX, y);
            Rectangle displayRect = DisplayRectangle;

            for (int row = FirstVisibleRow; row < RowCount; row++)
            {
                Rectangle rowRect = _rowLayout.GetRowBounds(row);
                gridHeight += rowRect.Height;
                if (rowRect.Y + y > displayRect.Bottom)
                {
                    break;
                }
                else
                {
                    DrawRow(e, ref context, row, rowRect);
                }
            }

            if ((GridLineStyle & GridLineStyle.Vertical) == GridLineStyle.Vertical && UseColumns)
            {
                DrawVerticalGridLines(e.Graphics, firstRowY);
            }

            if (_dropPosition.Node != null && DragMode && HighlightDropPosition)
            {
                DrawDropMark(e.Graphics);
            }

            e.Graphics.ResetTransform();
            DrawScrollBarsBox(e.Graphics);

            if (DragMode && _dragBitmap != null)
            {
                e.Graphics.DrawImage(_dragBitmap, PointToClient(MousePosition));
            }

            PerformanceAnalyzer.Finish("OnPaint");
            EndPerformanceCount(e);
        }