private void setMineLabelValues() { for (int y = 0; y < GameData.Height; y++) { for (int x = 0; x < GameData.Width; x++) { Label mineLabel = GameForm.Controls.Find(string.Format("mineLabelX{0}Y{1}", x, y), true)[0] as Label; if (GameData.GetCellValue(x, y) == 9) { mineLabel.Text = "X"; mineLabel.ForeColor = GameData.GetCellColor(x, y); mineLabel.BackColor = Color.LightGray; } else if (GameData.GetCellValue(x, y) == 0) { mineLabel.Text = ""; } else { mineLabel.Text = GameData.GetCellValue(x, y).ToString(); mineLabel.ForeColor = GameData.GetCellColor(x, y); } } } }