Kissen
Member
- Joined
- Jun 20, 2019
- Messages
- 13
- Programming Experience
- Beginner
I created an array of buttons that should create a square of size gridSize. But I have no Idea how to make the buttons go where they are supposed to, they always overlap
C#:
Button[,] tiles = new Button[gridSize,gridSize];
int buttonSize = this.ClientRectangle.Width / gridSize;
for(int x =0; x<gridSize; x++)
{
for(int y= 0; y<gridSize; y++)
{
tiles[x, y] = new Button();
tiles[x, y].Size = new Size(buttonSize, buttonSize);
tiles[x, y].Location = new Point(gridSize*x, y*gridSize);
this.Controls.Add(tiles[x,y]);