Formatting fix

This commit is contained in:
Robin Krom 2021-02-19 23:06:41 +01:00 committed by GitHub
commit ee9d1325b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {
/// <summary>
/// See: http://nickstips.wordpress.com/2010/03/03/c-panel-resets-scroll-position-after-focus-is-lost-and-regained/
/// </summary>
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
{
/// <summary>
/// See: http://nickstips.wordpress.com/2010/03/03/c-panel-resets-scroll-position-after-focus-is-lost-and-regained/
/// </summary>
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;
}
/// <summary>
/// Add horizontal scrolling to the panel, when using the wheel and the shift key is pressed
/// </summary>
/// <param name="e">MouseEventArgs</param>
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)
/// <summary>
/// Add horizontal scrolling to the panel, when using the wheel and the shift key is pressed
/// </summary>
/// <param name="e">MouseEventArgs</param>
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);
}
}
}
}
}