private void Form1_Paint(object sender, PaintEventArgs e) { Cell c = new Cell(); c.Rec = this.ClientRectangle; c.Text = "No Name"; c.Paint(e.Graphics, this.Font); }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); for (int i = 0; i < this.CellsCount; i++) { Cell c = this.cells[i]; if (e.ClipRectangle.IntersectsWith(Rectangle.Round(c.Rec))) { c.Paint(e.Graphics, this.Font); } } }