+1  A: 

Have you tried using Application.DoEvents(); before the wait time? I believe that should force C# to draw the image before going to sleep.

Joel Alejandro
OP said (on a now-deleted answer): thank you a lot for the answers !!!!! "Application.DoEvents();" is all i needed, works now :-) I cannot thank you enough, because i already spent hours to get this to work....
Marc Gravell
From my own perspective, Application.DoEvents is not ideal in most scenarios...
Marc Gravell
+2  A: 

I would use the LoadCompleted event and start a timer with 5 sec interval once the image is loaded, so that the UI thread is not blocked:

   private void button1_Click(object sender, EventArgs e)
    {
        pictureBox1.WaitOnLoad = false;
        pictureBox1.LoadCompleted += new AsyncCompletedEventHandler(pictureBox1_LoadCompleted);
        pictureBox1.LoadAsync("image.jpg");
    }

    void pictureBox1_LoadCompleted(object sender, AsyncCompletedEventArgs e)
    {
        //System.Timers.Timer is used as it supports multithreaded invocations
        System.Timers.Timer timer = new System.Timers.Timer(5000); 

        timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);

        //set this so that the timer is stopped once the elaplsed event is fired
        timer.AutoReset = false; 

        timer.Enabled = true;
    }

    void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
    {
        MessageBox.Show("test"); //just to test, here should be the code to play the mp3
    }
Petar Kabashki
OP said (on a now-deleted answer): using a timer works too, but the above [Application.DoEvents] is easier to implement
Marc Gravell
A: 

it works when application.doevents() used.

private void button1_Click(object sender, EventArgs e) { pictureBox1.Load("image.jpg"); Application.DoEvents(); pictureBox1.WaitOnLoad = true; System.Threading.Thread.Sleep(5000); MessageBox.Show("test"); //just to test, here should be the code to play the mp3 }

Nivas