From ee9d1325b57a746371a56c476841ef69b9e975de Mon Sep 17 00:00:00 2001 From: Robin Krom Date: Fri, 19 Feb 2021 23:06:41 +0100 Subject: [PATCH] Formatting fix --- Greenshot/Controls/NonJumpingPanel.cs | 80 ++++++++++++++------------- 1 file changed, 42 insertions(+), 38 deletions(-) diff --git a/Greenshot/Controls/NonJumpingPanel.cs b/Greenshot/Controls/NonJumpingPanel.cs index f8595c28a..4d107da45 100644 --- a/Greenshot/Controls/NonJumpingPanel.cs +++ b/Greenshot/Controls/NonJumpingPanel.cs @@ -1,4 +1,4 @@ -/* +/* * Greenshot - a free and open source screenshot tool * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom * @@ -22,45 +22,49 @@ using System.Drawing; using System.Windows.Forms; -namespace GreenshotPlugin.Controls { - /// - /// See: http://nickstips.wordpress.com/2010/03/03/c-panel-resets-scroll-position-after-focus-is-lost-and-regained/ - /// - public class NonJumpingPanel : Panel { - protected override Point ScrollToControl(Control activeControl) { - // Returning the current location prevents the panel from - // scrolling to the active control when the panel loses and regains focus - return DisplayRectangle.Location; - } +namespace GreenshotPlugin.Controls +{ + /// + /// See: http://nickstips.wordpress.com/2010/03/03/c-panel-resets-scroll-position-after-focus-is-lost-and-regained/ + /// + public class NonJumpingPanel : Panel + { + protected override Point ScrollToControl(Control activeControl) + { + // Returning the current location prevents the panel from + // scrolling to the active control when the panel loses and regains focus + return DisplayRectangle.Location; + } - /// - /// Add horizontal scrolling to the panel, when using the wheel and the shift key is pressed - /// - /// MouseEventArgs - protected override void OnMouseWheel(MouseEventArgs e) - {//Check if Scrollbars available and CTRL key pressed -> Zoom IN OUT - if((VScroll || HScroll)&& (ModifierKeys & Keys.Control) == Keys.Control) + /// + /// Add horizontal scrolling to the panel, when using the wheel and the shift key is pressed + /// + /// MouseEventArgs + protected override void OnMouseWheel(MouseEventArgs e) + { + //Check if Scrollbars available and CTRL key pressed -> Zoom IN OUT + if ((VScroll || HScroll) && (ModifierKeys & Keys.Control) == Keys.Control) { - VScroll = false; - HScroll = false; - base.OnMouseWheel(e); - VScroll = true; - HScroll = true; - } + VScroll = false; + HScroll = false; + base.OnMouseWheel(e); + VScroll = true; + HScroll = true; + } else { - //Vertical Scoll with SHIFT key pressed - if (VScroll && (ModifierKeys & Keys.Shift) == Keys.Shift ) - { - VScroll = false; - base.OnMouseWheel(e); - VScroll = true; - } - else - { - base.OnMouseWheel(e); - } - } - } - } + //Vertical Scoll with SHIFT key pressed + if (VScroll && (ModifierKeys & Keys.Shift) == Keys.Shift) + { + VScroll = false; + base.OnMouseWheel(e); + VScroll = true; + } + else + { + base.OnMouseWheel(e); + } + } + } + } }