110,532
社区成员
发帖
与我相关
我的任务
分享
int num = 0;
Button[] bt=new Button[50];
for (int i = 0; i < bt.Length; i++)
{
int h = num / 10;
int v = num % 10;
bt[i] = new Button();
bt[i].Name = "Button" + Convert.ToString(i + 1);
bt[i].BackColor = Color.Black;
bt[i].Size = new System.Drawing.Size(50, 50);
bt[i].Location = new Point(h * 150 + 50, v * 150 + 50);
groupBox1.Controls.Add(bt[i]);
num++;
}