what does this code mean/do?

        Rectangle[] rects = new Rectangle[]
        {
            new Rectangle(8,8,119,86), new Rectangle(127,8,119,86), new Rectangle(246,8,121,86),
            new Rectangle(8,94,119,90), new Rectangle(127,94,119,90), new Rectangle(246,94,121,90),
            new Rectangle(8,184,119,88), new Rectangle(127,184,119,88), new Rectangle(246,184,121,88)
        };
        formGfx.DrawRectangles(pen, rects);

Recommended Answers

All 2 Replies

It shows a 3x3 grid of 9 rectangles, defined in the rects array.
This is a more complete working example:
Make an empty forms application and put this in the forms Paint event handler.

private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Rectangle[] rects = new Rectangle[]
            {
            new Rectangle(8,8,119,86), new Rectangle(127,8,119,86), new Rectangle(246,8,121,86),
            new Rectangle(8,94,119,90), new Rectangle(127,94,119,90), new Rectangle(246,94,121,90),
            new Rectangle(8,184,119,88), new Rectangle(127,184,119,88), new Rectangle(246,184,121,88)
            };
            Pen myPen = new Pen(Color.Blue);
            e.Graphics.DrawRectangles(myPen, rects); 
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.