I thought Shown
would be the answer. But it seems that not all controls are equal. The panel is displayed immediately, but the shortcut is not.
I have the following code:
public partial class Form2 : Form { Panel p = new Panel() { BackColor = Color.Green }; Label l = new Label() { Text = "abc", Location = new Point(0, 100) }; public Form2() { Controls.Add(p); Controls.Add(l); Shown += new EventHandler(Form2_Shown); } void Form2_Shown(object sender, EventArgs e) { System.Threading.Thread.Sleep(2000); } }
What initially shows this:

And after 2 seconds it is:

So, how do I run the code after the "second image"?
source share