G
Guest
I have make a class derived from the System.Windows.Forms.Control class
I have write this method,
protected override void OnPaint(PaintEventArgs e)
{
Pen myPen = new Pen(Color.Black, 1);
e.Graphics.DrawEllipse(myPen, 10,10, 8,8);
SolidBrush Colore=new SolidBrush(Color.Red);
e.Graphics.FillEllipse(Colore,10,10,8,8);
}
because I wont that if I add this control to my form, it must draw a circle.
So in my form I write
MyControl myobj=new MyControl ();
Form.Controls.Add(MyControl );
The problem is that the onPaint event is never called, so I don't see tje
circle.
Someone can help me?
Thank's
Boni
I have write this method,
protected override void OnPaint(PaintEventArgs e)
{
Pen myPen = new Pen(Color.Black, 1);
e.Graphics.DrawEllipse(myPen, 10,10, 8,8);
SolidBrush Colore=new SolidBrush(Color.Red);
e.Graphics.FillEllipse(Colore,10,10,8,8);
}
because I wont that if I add this control to my form, it must draw a circle.
So in my form I write
MyControl myobj=new MyControl ();
Form.Controls.Add(MyControl );
The problem is that the onPaint event is never called, so I don't see tje
circle.
Someone can help me?
Thank's
Boni