Document

//遍历所有按钮
foreach (Control x in this.Controls)
{
       Control y = x as Button;
       if (y != null)
       {
             //操作
       }
}

//遍历n个按钮
for(int i=1;i<n;i++)
{
        Button btn = this.Controls["button" + i.ToString()] as Button;
        //操作
}
原文地址:https://www.cnblogs.com/precious112/p/13792323.html