Exemplo n.º 1
0
        // Instead of methods in the form that paint a rectangle we now want to
        // make a class responsible to draw itself on the form canvas
        private void formPaintClass(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            Graphics      g  = this.CreateGraphics();
            SquarePainter sp = new SquarePainter(g);

            sp.paint();
        }
Exemplo n.º 2
0
        // Now let's add a new type of painter class
        // Let's draw also a circle
        private void formPaintMultipleTypes(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            Graphics      g  = this.CreateGraphics();
            SquarePainter sp = new SquarePainter(g);

            sp.paint();


            CirclePainter cp = new CirclePainter(g);

            cp.paint();
        }