private void Preview_FormClosing(object sender, FormClosingEventArgs e) { if (imageWorks != null) { imageWorks.img.Dispose(); imageWorks = null; } }
private void CreatePreview() { imageWorks?.img?.Dispose(); imageWorks = new ImageWorks((filesListBox.SelectedItem as ImageInformation)); bool isOK = imageWorks.TryCreateImageWithCorrectOrientation(); if (isOK) { pictureBox.Image = imageWorks?.ScaleImage(pictureBox.Width, pictureBox.Height, Color.White); } else { pictureBox.Image = null; } }
private void ShowImage() { imageWorks = new ImageWorks(imageInformation); imageWorks.TryCreateImageWithCorrectOrientation(); pictureBox.Image = imageWorks?.ScaleImage(pictureBox.Width, pictureBox.Height, Color.White); }