protected virtual void OnRangePaint(RangePaintEventArgs e)
{
Rectangle drawRectangle = RangeToRectangle(e.DrawingRange);
System.Drawing.Drawing2D.GraphicsState state = e.GraphicsCache.Graphics.Save();
try
{
e.GraphicsCache.Graphics.SetClip(drawRectangle);
int top = drawRectangle.Top;
int width;
int height;
for (int r = e.DrawingRange.Start.Row; r <= e.DrawingRange.End.Row; r++)
{
height = Rows.GetHeight(r);
int left = drawRectangle.Left;
for (int c = e.DrawingRange.Start.Column; c <= e.DrawingRange.End.Column; c++)
{
width = Columns.GetWidth(c);
Position position = new Position(r, c);
Cells.ICellVirtual cell = GetCell(position);
if (cell != null)
{
CellContext cellContext = new CellContext(this, position, cell);
Rectangle drawRect = new Rectangle(left, top, width, height);
PaintCell(e.GraphicsCache, cellContext, drawRect);
}
left += width;
}
top += height;
}
//Draw the decorators
foreach (SourceGrid.Decorators.DecoratorBase dec in Decorators)
{
if (dec.IntersectWith(e.DrawingRange))
dec.Draw(e);
}
if (RangePaint != null)
RangePaint(this, e);
}
finally
{
e.GraphicsCache.Graphics.Restore(state);
}
}