views:

159

answers:

2

Hi,

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.

+1  A: 

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

You can just create a new Window class and load your prictures 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.

Foxfire
A: 
private void startButton_Click(object sender, EventArgs e)
{
    // Ensure WaitOnLoad is false.
    pictureBox1.WaitOnLoad = false;

    // Load the image asynchronously.
    pictureBox1.LoadAsync(@"http://localhost/print.gif");
}

Courtesy of MSDN: http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.waitonload(v=VS.100).aspx1

code4life