From e89aa418da1135991325caba48ca3a736129e65e Mon Sep 17 00:00:00 2001 From: Jaex Date: Tue, 29 Sep 2015 15:57:26 +0300 Subject: [PATCH] Scrolling capture output image won't scroll when updating values with control, if image crop failed then ignore it --- .../Forms/ScrollingCaptureForm.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureForm.cs b/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureForm.cs index 75914b64f..99bc28735 100644 --- a/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureForm.cs +++ b/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureForm.cs @@ -266,13 +266,14 @@ private void Clean() } } - private void CleanPictureBox() + private void CleanPictureBox(Image img = null) { Image temp = pbOutput.Image; + pbOutput.Image = img; + if (temp != null) { - pbOutput.Image = null; temp.Dispose(); } } @@ -534,8 +535,8 @@ private void CombineAndPreviewImagesFromControl() { if (!isBusy) { - CleanPictureBox(); - CombineAndPreviewImages(); + Result = CombineImages(); + CleanPictureBox(Result); } } @@ -582,6 +583,11 @@ private Image CombineImages() } newImage = ImageHelpers.CropImage(image, rect); + + if (newImage == null) + { + continue; + } } if (newImage == null)