private void button1_Click(object sender, EventArgs e) { Form2 f = new Form2(); if (f.ShowDialog() == DialogResult.Cancel) { return; } cards.Add(new Card(f.GetName(), f.GetNumbers())); pictureBox1.Height = cards.Count * (cw + 30); pictureBox1.Invalidate(); }