/// <summary> /// Update image on the form /// </summary> /// <param name="box">Picture box</param> /// <param name="img">Image</param> private void UpdatePicture(PictureBox box, Image img) { if (box.InvokeRequired) { var d = new UpdatePictureCallback(UpdatePicture); Invoke(d, box, img); } else { box.Image = img; } }
private void setDancingPicture(Bitmap bitmap) { if (this.InvokeRequired) { UpdatePictureCallback d = new UpdatePictureCallback(setDancingPicture); this.BeginInvoke(d, bitmap); return; } if (bitmap != null) { pictureBoxCelebrate.Image = bitmap; } else { pictureBoxCelebrate.Visible = false; } }