I am attempting to just draw basic shapes to a panel on my form. so far nothing happens and I dont know why. This method is called in the constructor of my form.
private void doGraphics()
{
Pen p = new Pen(Color.Black);//draws wire frame Shapes
SolidBrush sb = new SolidBrush(Color.Yellow);//draws filled Shapes
Graphics g = panel1.CreateGraphics();
Point[] pointArray = { new Point(100, 20), new Point(100, 0), new Point(120, 0), new Point(120, 20) };
g.FillPolygon(sb, pointArray);
g.DrawPolygon(p, pointArray);
}
Any suggestions would be great!
You need to register to the
Paintevent of the panel and use the graphics object that comes with the arguments:In constructor:
The handler itself: