我有一个想要通过组合其他两个字符串指定的pictureBox。让我们说pictureBox被称为Tile20我该怎么办?我如何使这项工作?:
if("Tile" + "20".Tag == "Hello")
{
rest of the code...
}
答案 0 :(得分:1)
试试这样:
PictureBox pictureBox = (PictureBox)this.Controls.Find(string.Concat("Tile","20")).FirstOrDefault();
if (pictureBox != null)
{
if (pictureBox.Tag == "Hello")
{
rest of the code...
}
}