protected override void OnPaint(PaintEventArgs e) { //SystemColors //Graphics g = e.Graphics; Graphics g = this.CreateGraphics(); MyClass c = new MyClass(); c.Draw(g); g.Dispose(); }
private void Form1_Paint(object sender, PaintEventArgs e) { //e.Graphics.DrawEllipse(Pens.Black, 0,0,100,100); //Graphics g = e.Graphics; Graphics g = this.CreateGraphics(); try { //g.DrawLine(Pens.Black, new Point(0,0), new Point(30, 50)); MyClass c = new MyClass(); c.Draw(g); } finally { if (g != null) { ((IDisposable)g).Dispose(); } } }
protected override void OnPaint(PaintEventArgs e) { //e.Graphics.DrawEllipse(Pens.Black, 0,0,100,100); //Graphics g = e.Graphics; Graphics g = this.CreateGraphics(); try { //g.DrawLine(Pens.Black, new Point(0,0), new Point(30, 50)); MyClass c = new MyClass(); c.Draw(g); } finally { if (g != null) { ((IDisposable)g).Dispose(); } } }