diff --git a/ShareX.HelpersLib/Properties/Resources.Designer.cs b/ShareX.HelpersLib/Properties/Resources.Designer.cs index 8f7722c70..3b7bef4fc 100644 --- a/ShareX.HelpersLib/Properties/Resources.Designer.cs +++ b/ShareX.HelpersLib/Properties/Resources.Designer.cs @@ -2966,6 +2966,42 @@ namespace ShareX.HelpersLib.Properties { } } + /// + /// Looks up a localized string similar to Down arrow. + /// + internal static string ScrollMethod_DownArrow { + get { + return ResourceManager.GetString("ScrollMethod_DownArrow", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Mouse wheel. + /// + internal static string ScrollMethod_MouseWheel { + get { + return ResourceManager.GetString("ScrollMethod_MouseWheel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Page down. + /// + internal static string ScrollMethod_PageDown { + get { + return ResourceManager.GetString("ScrollMethod_PageDown", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Scroll message. + /// + internal static string ScrollMethod_ScrollMessage { + get { + return ResourceManager.GetString("ScrollMethod_ScrollMessage", resourceCulture); + } + } + /// /// Looks up a localized string similar to Arrow (A). /// diff --git a/ShareX.HelpersLib/Properties/Resources.resx b/ShareX.HelpersLib/Properties/Resources.resx index d801a23de..b12ef5c7d 100644 --- a/ShareX.HelpersLib/Properties/Resources.resx +++ b/ShareX.HelpersLib/Properties/Resources.resx @@ -1302,4 +1302,16 @@ Would you like to download and install it? QR code (Scan region) + + Down arrow + + + Mouse wheel + + + Page down + + + Scroll message + \ No newline at end of file diff --git a/ShareX.ScreenCaptureLib/Enums.cs b/ShareX.ScreenCaptureLib/Enums.cs index 9253f86a8..dd0b2f0ce 100644 --- a/ShareX.ScreenCaptureLib/Enums.cs +++ b/ShareX.ScreenCaptureLib/Enums.cs @@ -371,4 +371,12 @@ namespace ShareX.ScreenCaptureLib PartiallySuccessful, Successful } + + public enum ScrollMethod // Localized + { + MouseWheel, + DownArrow, + PageDown, + ScrollMessage + } } \ No newline at end of file diff --git a/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureOptionsForm.Designer.cs b/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureOptionsForm.Designer.cs index feab2438e..490aa39a9 100644 --- a/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureOptionsForm.Designer.cs +++ b/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureOptionsForm.Designer.cs @@ -44,6 +44,8 @@ this.btnCancel = new System.Windows.Forms.Button(); this.cbShowRegion = new System.Windows.Forms.CheckBox(); this.cbAutoIgnoreBottomEdge = new System.Windows.Forms.CheckBox(); + this.cbScrollMethod = new System.Windows.Forms.ComboBox(); + this.lblScrollMethod = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.nudStartDelay)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudScrollDelay)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudScrollAmount)).BeginInit(); @@ -124,7 +126,7 @@ // resources.ApplyResources(this.nudScrollAmount, "nudScrollAmount"); this.nudScrollAmount.Maximum = new decimal(new int[] { - 5, + 6, 0, 0, 0}); @@ -187,10 +189,25 @@ this.cbAutoIgnoreBottomEdge.Name = "cbAutoIgnoreBottomEdge"; this.cbAutoIgnoreBottomEdge.UseVisualStyleBackColor = true; // + // cbScrollMethod + // + this.cbScrollMethod.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbScrollMethod.FormattingEnabled = true; + resources.ApplyResources(this.cbScrollMethod, "cbScrollMethod"); + this.cbScrollMethod.Name = "cbScrollMethod"; + this.cbScrollMethod.SelectedIndexChanged += new System.EventHandler(this.cbScrollMethod_SelectedIndexChanged); + // + // lblScrollMethod + // + resources.ApplyResources(this.lblScrollMethod, "lblScrollMethod"); + this.lblScrollMethod.Name = "lblScrollMethod"; + // // ScrollingCaptureOptionsForm // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.Controls.Add(this.lblScrollMethod); + this.Controls.Add(this.cbScrollMethod); this.Controls.Add(this.cbAutoIgnoreBottomEdge); this.Controls.Add(this.cbShowRegion); this.Controls.Add(this.btnCancel); @@ -234,5 +251,7 @@ private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.CheckBox cbShowRegion; private System.Windows.Forms.CheckBox cbAutoIgnoreBottomEdge; + private System.Windows.Forms.ComboBox cbScrollMethod; + private System.Windows.Forms.Label lblScrollMethod; } } \ No newline at end of file diff --git a/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureOptionsForm.cs b/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureOptionsForm.cs index ca34d5daf..099fd3aec 100644 --- a/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureOptionsForm.cs +++ b/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureOptionsForm.cs @@ -39,6 +39,7 @@ namespace ShareX.ScreenCaptureLib InitializeComponent(); ShareXResources.ApplyTheme(this, true); + cbScrollMethod.Items.AddRange(Helpers.GetLocalizedEnumDescriptions()); LoadOptions(); } @@ -48,6 +49,7 @@ namespace ShareX.ScreenCaptureLib nudStartDelay.SetValue(Options.StartDelay); cbAutoScrollTop.Checked = Options.AutoScrollTop; nudScrollDelay.SetValue(Options.ScrollDelay); + cbScrollMethod.SelectedIndex = (int)Options.ScrollMethod; nudScrollAmount.SetValue(Options.ScrollAmount); cbAutoUpload.Checked = Options.AutoUpload; cbShowRegion.Checked = Options.ShowRegion; @@ -59,12 +61,22 @@ namespace ShareX.ScreenCaptureLib Options.StartDelay = (int)nudStartDelay.Value; Options.AutoScrollTop = cbAutoScrollTop.Checked; Options.ScrollDelay = (int)nudScrollDelay.Value; + Options.ScrollMethod = (ScrollMethod)cbScrollMethod.SelectedIndex; Options.ScrollAmount = (int)nudScrollAmount.Value; Options.AutoUpload = cbAutoUpload.Checked; Options.ShowRegion = cbShowRegion.Checked; Options.AutoIgnoreBottomEdge = cbAutoIgnoreBottomEdge.Checked; } + private void cbScrollMethod_SelectedIndexChanged(object sender, EventArgs e) + { + bool hideScrollAmount = (ScrollMethod)cbScrollMethod.SelectedIndex == ScrollMethod.PageDown; + + lblScrollAmount.Visible = !hideScrollAmount; + nudScrollAmount.Visible = !hideScrollAmount; + lblScrollAmountHint.Visible = !hideScrollAmount; + } + private void btnOK_Click(object sender, EventArgs e) { SaveOptions(); diff --git a/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureOptionsForm.resx b/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureOptionsForm.resx index 0cb39a597..1c5f546bb 100644 --- a/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureOptionsForm.resx +++ b/ShareX.ScreenCaptureLib/Forms/ScrollingCaptureOptionsForm.resx @@ -144,7 +144,7 @@ $this - 14 + 16 16, 40 @@ -169,7 +169,7 @@ $this - 13 + 15 True @@ -196,7 +196,7 @@ $this - 12 + 14 16, 136 @@ -220,7 +220,7 @@ $this - 11 + 13 True @@ -247,19 +247,19 @@ $this - 10 + 12 True - 13, 176 + 165, 176 91, 16 - 7 + 9 Scroll amount: @@ -274,16 +274,16 @@ $this - 9 + 11 - 16, 200 + 168, 201 - 80, 22 + 64, 22 - 8 + 10 Center @@ -298,19 +298,19 @@ $this - 8 + 10 True - 16, 240 + 16, 304 191, 20 - 10 + 14 Automatically upload / save @@ -325,7 +325,7 @@ $this - 7 + 9 True @@ -352,7 +352,7 @@ $this - 6 + 8 True @@ -379,19 +379,19 @@ $this - 5 + 7 True - 101, 203 + 237, 204 39, 16 - 9 + 11 times @@ -406,7 +406,7 @@ $this - 4 + 6 152, 336 @@ -415,7 +415,7 @@ 104, 32 - 13 + 15 OK @@ -430,7 +430,7 @@ $this - 3 + 5 264, 336 @@ -439,7 +439,7 @@ 104, 32 - 14 + 16 Cancel @@ -454,7 +454,7 @@ $this - 2 + 4 True @@ -466,7 +466,7 @@ 201, 20 - 11 + 13 Show scrolling capture region @@ -481,13 +481,13 @@ $this - 1 + 3 True - 16, 304 + 16, 240 173, 20 @@ -508,6 +508,54 @@ $this + 2 + + + 16, 200 + + + 144, 24 + + + 8 + + + cbScrollMethod + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + True + + + 13, 176 + + + 92, 16 + + + 7 + + + Scroll method: + + + lblScrollMethod + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + 0 diff --git a/ShareX.ScreenCaptureLib/ScrollingCaptureManager.cs b/ShareX.ScreenCaptureLib/ScrollingCaptureManager.cs index 5564edc93..95bcdb612 100644 --- a/ShareX.ScreenCaptureLib/ScrollingCaptureManager.cs +++ b/ShareX.ScreenCaptureLib/ScrollingCaptureManager.cs @@ -127,7 +127,27 @@ namespace ShareX.ScreenCaptureLib break; } - InputHelpers.SendMouseWheel(-120 * Options.ScrollAmount); + switch (Options.ScrollMethod) + { + case ScrollMethod.MouseWheel: + InputHelpers.SendMouseWheel(-120 * Options.ScrollAmount); + break; + case ScrollMethod.DownArrow: + for (int i = 0; i < Options.ScrollAmount; i++) + { + InputHelpers.SendKeyPress(VirtualKeyCode.DOWN); + } + break; + case ScrollMethod.PageDown: + InputHelpers.SendKeyPress(VirtualKeyCode.NEXT); + break; + case ScrollMethod.ScrollMessage: + for (int i = 0; i < Options.ScrollAmount; i++) + { + NativeMethods.SendMessage(selectedWindow.Handle, (int)WindowsMessages.VSCROLL, (int)ScrollBarCommands.SB_LINEDOWN, 0); + } + break; + } Stopwatch timer = Stopwatch.StartNew(); diff --git a/ShareX.ScreenCaptureLib/ScrollingCaptureOptions.cs b/ShareX.ScreenCaptureLib/ScrollingCaptureOptions.cs index e7c8aa1dc..a11c73936 100644 --- a/ShareX.ScreenCaptureLib/ScrollingCaptureOptions.cs +++ b/ShareX.ScreenCaptureLib/ScrollingCaptureOptions.cs @@ -30,6 +30,7 @@ namespace ShareX.ScreenCaptureLib public int StartDelay { get; set; } = 300; public bool AutoScrollTop { get; set; } = false; public int ScrollDelay { get; set; } = 300; + public ScrollMethod ScrollMethod { get; set; } = ScrollMethod.MouseWheel; public int ScrollAmount { get; set; } = 2; public bool AutoIgnoreBottomEdge { get; set; } = true; public bool AutoUpload { get; set; } = false;