zaidwaqi zaidwaqi - 3 months ago 15
C# Question

Load image in PictureBox before make control visible

I have a form with black background, with 9 picture boxes.
When the program starts, I want to show 9 images using these picture boxes.

However, the picture boxes take time to load the picture. It is quite ugly that the picture boxes show up first while waiting.

Is there a way I can move from blank black screen to straightaway 9 images, without the visible loading in between?

Thanks.

Answer

How are you loading your Form (I guess you are talking about Windows.Forms here)?

You can just create a new Window class and load your pictures and then after all is done call the Show method.

MyForm form = new MyForm ();
form.DoLoadImages ();
form.Show ();

Or you can just set the WaitOnLoad property of the PictureBox to true.