Exemple #1
0
    protected override void OnPaint(PaintEventArgs e)
    {
        Graphics board = e.Graphics;

        Pen bluepen = new Pen(Color.Blue, 2);

        board.DrawLine(bluepen, 1, 700, 999, 700);
        SolidBrush yellowbrush = new SolidBrush(Color.White);

        board.FillRectangle(yellowbrush, 0, 0, 1000, 700);

        Pen cpen = new Pen(c, 2);

        cpen.Color = c1;
        Rectangle info = CircleAlgorithms.getInformation(1000, 700, 100);

        board.DrawEllipse(cpen, info);
        cpen.Color = c2;
        info       = CircleAlgorithms.getInformation(1000, 700, 200);
        board.DrawEllipse(cpen, info);
        cpen.Color = c3;
        info       = CircleAlgorithms.getInformation(1000, 700, 300);
        board.DrawEllipse(cpen, info);

        base.OnPaint(e);
    }
Exemple #2
0
    //draws onto the screen
    protected override void OnPaint(PaintEventArgs anything)
    {
        Graphics area = anything.Graphics;

        System.Drawing.Rectangle r = new System.Drawing.Rectangle();

        //makes a copy of the class Graphics
        Pen pen = new Pen(Brushes.Pink, 3);

        pen.Color = color200;     //this gives us something to write with
        r         = CircleAlgorithms.getcircleinfo(1500, 1260, 200);
        area.DrawEllipse(pen, r); //we're doubling to make the diameter

        pen.Color = color400;
        r         = CircleAlgorithms.getcircleinfo(1500, 1260, 400);
        area.DrawEllipse(pen, r);

        pen.Color = color600;
        r         = CircleAlgorithms.getcircleinfo(1500, 1260, 600);
        area.DrawEllipse(pen, r);



        // Create solid brush.
        SolidBrush blueBrush = new SolidBrush(Color.SkyBlue);

        // Create rectangle.
        Rectangle rect = new Rectangle(0, 1260, 1500, 1500);

        // Fill rectangle to screen.
        anything.Graphics.FillRectangle(blueBrush, rect);
        //area.FillRectangle(pen, 0,360,1000,900);
        base.OnPaint(anything);
    }