0

How do I create a border made of picture boxes, I'm trying to make a snake game and I want to first make a border for the playing area, using picture boxes, so far I have used a while loop to make the top row but I feel there would be a better way to make the whole thing, I heard a helper function may help but I'm not sure how to go about that either

int i = 1;


    public Snake()
    {
        InitializeComponent();


    }

    private void Snake_Load(object sender, EventArgs e)
    {

        while (i < 404)
        {
            var picture = new PictureBox
            {
                Name = "pictureBox",
                Size = new Size(20, 20),
                Location = new Point(i, 0),
                BackColor = Color.FromArgb(0,0,0),


            };
            this.Controls.Add(picture);
            i += 20;
        }

    }
Alex
  • 29
  • 4

0 Answers0