protected override void OnPaint(PaintEventArgs e)
{
// call baseclass
base.OnPaint(e);
// check if we actually need to paint
if (this.Width == 0 || this.Height == 0)
return;
if (this.ColumnModel != null)
{
// keep a record of the current clip region
Region clip = e.Graphics.Clip;
if (this.TableModel != null && this.TableModel.Rows.Count > 0)
{
this.OnPaintRows(e);
// reset the clipping region
e.Graphics.Clip = clip;
}
if (this.GridLines != GridLines.None)
this.OnPaintGrid(e);
if (this.HeaderStyle != ColumnHeaderStyle.None && this.ColumnModel.Columns.Count > 0)
{
if (this.HeaderRectangle.IntersectsWith(e.ClipRectangle))
this.OnPaintHeader(e);
}
// reset the clipping region
e.Graphics.Clip = clip;
}
this.OnPaintEmptyTableText(e);
this.OnPaintBorder(e);
if (!painted)
{
painted = true;
FirstPaint();
}
}