/// <summary> /// Dispose of the CurrentBitmap and replace it with the given bitmap. /// </summary> /// <param name="bmp">The new bitmap.</param> public void ReplaceBitmap(Bitmap bmp) { if (CurrentBitmap != null) { CurrentBitmap.Dispose(); } CurrentBitmap = IMAGE.ProperCast(bmp, this.Format); }
private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { MessageBox.Show("Failed to transform image. " + e.Error.GetBaseException().Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (!e.Cancelled) { ibMain.Image = IMAGE.ProperCast(e.Result as Bitmap, originalImage.GetImageFormat()); } Cursor.Current = Cursors.Default; this.UseWaitCursor = false; }
/// <summary> /// Sets the CurrentBitmap and does not dispose of the last bitmap. /// </summary> /// <param name="bmp">The new bitmap.</param> public void UpdateBitmapReferance(Bitmap bmp) { CurrentBitmap = IMAGE.ProperCast(bmp, this.Format); }