Exemple #1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            using (_renderer.LockGraphics(e.Graphics))
            {
                // White Background
                _renderer.SetBrush(Color.White);
                _renderer.SetSolidPen(Color.White);
                _renderer.FillRectangle(e.ClipRectangle);

                // Lag frame calculations
                SetLagFramesArray();

                List <RollColumn> visibleColumns;

                if (HorizontalOrientation)
                {
                    CalculateHorizontalColumnPositions(VisibleColumns.ToList());
                    visibleColumns = VisibleColumns
                                     .Take(_horizontalColumnTops.Count(c => c < e.ClipRectangle.Height))
                                     .ToList();
                }
                else
                {
                    visibleColumns = _columns.VisibleColumns
                                     .Where(c => c.Right > _hBar.Value)
                                     .Where(c => c.Left - _hBar.Value < e.ClipRectangle.Width)
                                     .ToList();
                }

                var firstVisibleRow = Math.Max(FirstVisibleRow, 0);
                var visibleRows     = HorizontalOrientation
                                        ? e.ClipRectangle.Width / CellWidth
                                        : e.ClipRectangle.Height / CellHeight;

                var lastVisibleRow = firstVisibleRow + visibleRows;

                var needsColumnRedraw = HorizontalOrientation || e.ClipRectangle.Y < ColumnHeight;
                if (visibleColumns.Any() && needsColumnRedraw)
                {
                    DrawColumnBg(visibleColumns, e.ClipRectangle);
                    DrawColumnText(visibleColumns);
                }

                // Background
                DrawBg(visibleColumns, e.ClipRectangle, firstVisibleRow, lastVisibleRow);

                // Foreground
                DrawData(visibleColumns, firstVisibleRow, lastVisibleRow);

                DrawColumnDrag(visibleColumns);
                DrawCellDrag(visibleColumns);
            }
        }
            // TODO: this shouldn't be exposed.  But in order to not expose it, each RollColumn must have a change callback, and all property changes must call it, it is quicker and easier to just call this when needed
            public void ColumnsChanged()
            {
                int pos = 0;

                var columns = VisibleColumns.ToList();

                for (int i = 0; i < columns.Count; i++)
                {
                    columns[i].Left  = pos;
                    pos             += columns[i].Width.Value;
                    columns[i].Right = pos;
                }

                DoChangeCallback();
            }
Exemple #3
0
 protected internal IList <DataColumnBase> GetVisibleColumns()
 {
     return(VisibleColumns.ToList <DataColumnBase>());
 }
Exemple #4
0
 protected internal IList <ITreeDataColumnElement> GetVisibleColumns()
 {
     return(VisibleColumns.ToList <ITreeDataColumnElement>());
 }