Beispiel #1
0
        public void PaintMergedCell(GraphicsCache graphics, Range cellRange, CellContext cellContext)
        {
            Grid grid = m_Grid as Grid;

            if (grid == null)
            {
                return;
            }

            Rectangle spanRect = grid.RangeToRectangle(cellRange);

            grid.PaintMergedCell(graphics, cellContext, spanRect);
        }
Beispiel #2
0
        public void PaintMergedCell(GraphicsCache graphics, Range cellRange, CellContext cellContext)
        {
            Grid grid = m_Grid as Grid;

            if (grid == null)
            {
                return;
            }

            GraphicsState state = graphics.Graphics.Save();

            graphics.Graphics.ResetClip();
            graphics.Graphics.ResetTransform();

            Rectangle spanRect = grid.RangeToRectangle(cellRange);

            Rectangle clientRectangle = grid.RangeToVisibleRectangle(cellRange);

            int actualFixedColumns = grid.ActualFixedColumns;
            int actualFixedRows    = grid.ActualFixedRows;

            if (cellRange.Start.Column < actualFixedColumns && cellRange.End.Column >= actualFixedColumns)
            {
                spanRect.Width = clientRectangle.Width;
            }

            if (cellRange.Start.Row < actualFixedRows && cellRange.End.Row >= actualFixedRows)
            {
                spanRect.Height = clientRectangle.Height;
            }


            graphics.Graphics.SetClip(clientRectangle);

            graphics.Graphics.TranslateTransform(spanRect.X - clientRectangle.X, spanRect.Y - clientRectangle.Y);

            spanRect.Location = clientRectangle.Location;

            using (GraphicsCache graphicsCache = new GraphicsCache(graphics.Graphics, Rectangle.Round(graphics.Graphics.ClipBounds)))
            {
                grid.PaintMergedCell(graphicsCache, cellContext, spanRect);
            }

            graphics.Graphics.ResetTransform();
            graphics.Graphics.ResetClip();
            graphics.Graphics.Restore(state);
        }