我需要为游戏制作一个 6x6 网格,但所有标签似乎都不起作用,
这可能是小事。
Label[][] map = new Label[6][];
for (int i = 0;i < columns;i++)
{
map[i] = new Label[6];
for (int j = 0; j < columns; j++)
{
map[i][j] = new Label();
map[i][j].AutoSize = true;
map[i][j].BackColor = Color.Black;
map[i][j].Location = new Point(i * spacing, j * spacing);
map[i][j].Name = "map" + i.ToString() + "," + j.ToString();
map[i][j].Width = spacing;
map[i][j].Height = spacing;
map[i][j].TabIndex = 0;
map[i][j].Text = "test" + i.ToString() + j.ToString();
panel1.Controls.Add(map[i][j]);
}
this.Controls.AddRange(map[i]);
}
MessageBox.Show("greatsuscces");
return;