diff --git a/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureLightForm.Designer.cs b/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureLightForm.Designer.cs index 020645a00..fff040501 100644 --- a/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureLightForm.Designer.cs +++ b/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureLightForm.Designer.cs @@ -7,19 +7,6 @@ partial class ScrollingCaptureLightForm /// private System.ComponentModel.IContainer components = null; - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - #region Windows Form Designer generated code /// @@ -70,6 +57,9 @@ private void InitializeComponent() this.pbOutput.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.pbOutput.TabIndex = 0; this.pbOutput.TabStop = false; + this.pbOutput.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbOutput_MouseDown); + this.pbOutput.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pbOutput_MouseMove); + this.pbOutput.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbOutput_MouseUp); // // tCapture // diff --git a/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureLightForm.cs b/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureLightForm.cs index ae5b426e5..68e58131f 100644 --- a/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureLightForm.cs +++ b/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureLightForm.cs @@ -47,6 +47,7 @@ public partial class ScrollingCaptureLightForm : Form private int currentScrollCount; private WindowInfo selectedWindow; private Rectangle selectedRectangle; + private Point dragStartPosition; public ScrollingCaptureLightForm(ScrollingCaptureOptions options) { @@ -58,6 +59,21 @@ public ScrollingCaptureLightForm(ScrollingCaptureOptions options) SelectWindow(); } + protected override void Dispose(bool disposing) + { + if (disposing) + { + if (components != null) + { + components.Dispose(); + } + + Reset(); + } + + base.Dispose(disposing); + } + private void Reset() { currentScrollCount = 0; @@ -111,7 +127,7 @@ private async Task StopCapture() if (isCapturing) { tCapture.Stop(); - Cursor = Cursors.WaitCursor; + pOutput.Cursor = Cursors.WaitCursor; // TODO: Translate btnCapture.Text = "Capture..."; btnCapture.Enabled = false; @@ -120,7 +136,7 @@ private async Task StopCapture() Result = await CombineImagesAsync(images); pbOutput.Image = Result; - Cursor = Cursors.Default; + pOutput.Cursor = Cursors.Default; btnCapture.Enabled = true; btnUpload.Enabled = true; isCapturing = false; @@ -310,6 +326,33 @@ private void btnOptions_Click(object sender, EventArgs e) } + private void pbOutput_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left && (pOutput.HorizontalScroll.Visible || pOutput.VerticalScroll.Visible)) + { + pOutput.Cursor = Cursors.SizeAll; + dragStartPosition = e.Location; + } + } + + private void pbOutput_MouseMove(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left && (pOutput.HorizontalScroll.Visible || pOutput.VerticalScroll.Visible)) + { + Point scrollOffset = new Point(e.X - dragStartPosition.X, e.Y - dragStartPosition.Y); + pOutput.AutoScrollPosition = new Point(-pOutput.AutoScrollPosition.X - scrollOffset.X, -pOutput.AutoScrollPosition.Y - scrollOffset.Y); + pOutput.Update(); + } + } + + private void pbOutput_MouseUp(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + pOutput.Cursor = Cursors.Default; + } + } + private async void tCapture_Tick(object sender, EventArgs e) { if (scrollTop) diff --git a/ShareX.ScreenCaptureLib/ScrollingCaptureOptions.cs b/ShareX.ScreenCaptureLib/ScrollingCaptureOptions.cs index a95e5df9c..c7d60705b 100644 --- a/ShareX.ScreenCaptureLib/ScrollingCaptureOptions.cs +++ b/ShareX.ScreenCaptureLib/ScrollingCaptureOptions.cs @@ -38,8 +38,8 @@ public class ScrollingCaptureOptions [DefaultValue(500)] public int ScrollDelay { get; set; } = 500; - [DefaultValue(20)] - public int MaximumScrollCount { get; set; } = 100; + [DefaultValue(200)] + public int MaximumScrollCount { get; set; } = 200; [DefaultValue(true)] public bool StartSelectionAutomatically { get; set; } = true;