/// <summary> /// Sets the picture box's Image in a thread-safe way. Makes the picture box visible and hides the video box. /// </summary> /// <param name="visible">Whether the picture box is visible</param> public void setPictureBoxPicture(Image theImage) { if (pictureBox.InvokeRequired) //wrong thread { setPictureBoxPictureCallback d = new setPictureBoxPictureCallback(setPictureBoxPicture); pictureBox.Invoke(d, new object[] { theImage }); } else //right thread { //stop any movie playing if there is one sendPlaybackEvent("stop"); //disable fullscreen if the player was fullscreen setVideoFullscreen(false); //restore the application if it was minimised to the system tray if (systemTrayIcon.Visible) { systemTrayIcon_DoubleClick(this, null); } //hide the video player if (usingQuicktime) { setQuicktimePlayerVisibility(false); } else { setPlayerVisibility(false); } //enable the image toolbar item imageToolStripMenuItem.Enabled = true; //show the picture box and set its image setPictureBoxVisibility(true); pictureBox.Image = theImage; } }