int top_btn = 10;
int left_btn = 10;
int x = 10;
int y = 10;
for (int i = 0; i < 5; i++)
{
Button button = new Button();
button.Left = left_btn;
button.Top = top_btn;
button.BackColor = Color.LightBlue;
button.Font = new Font("French Script MT", 10);
button.Name = "btn" + i;
button.Location = new Point(10, y);
button.Text = i.ToString();
button.Click += ButtonOnClick;
this.Controls.Add(button);
top_btn += button.Height = 23;
y = y + 30;
}