0

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);

Edited by mike_2000_17: Fixed formatting

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by ddanbe
0

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); 
        }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.