mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 04:59:30 -07:00
Formatting fix
This commit is contained in:
parent
a3e4f2f92e
commit
ee9d1325b5
1 changed files with 42 additions and 38 deletions
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Greenshot - a free and open source screenshot tool
|
* Greenshot - a free and open source screenshot tool
|
||||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||||
*
|
*
|
||||||
|
@ -22,45 +22,49 @@
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace GreenshotPlugin.Controls {
|
namespace GreenshotPlugin.Controls
|
||||||
/// <summary>
|
{
|
||||||
/// See: http://nickstips.wordpress.com/2010/03/03/c-panel-resets-scroll-position-after-focus-is-lost-and-regained/
|
/// <summary>
|
||||||
/// </summary>
|
/// See: http://nickstips.wordpress.com/2010/03/03/c-panel-resets-scroll-position-after-focus-is-lost-and-regained/
|
||||||
public class NonJumpingPanel : Panel {
|
/// </summary>
|
||||||
protected override Point ScrollToControl(Control activeControl) {
|
public class NonJumpingPanel : Panel
|
||||||
// Returning the current location prevents the panel from
|
{
|
||||||
// scrolling to the active control when the panel loses and regains focus
|
protected override Point ScrollToControl(Control activeControl)
|
||||||
return DisplayRectangle.Location;
|
{
|
||||||
}
|
// Returning the current location prevents the panel from
|
||||||
|
// scrolling to the active control when the panel loses and regains focus
|
||||||
|
return DisplayRectangle.Location;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add horizontal scrolling to the panel, when using the wheel and the shift key is pressed
|
/// Add horizontal scrolling to the panel, when using the wheel and the shift key is pressed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="e">MouseEventArgs</param>
|
/// <param name="e">MouseEventArgs</param>
|
||||||
protected override void OnMouseWheel(MouseEventArgs e)
|
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)
|
//Check if Scrollbars available and CTRL key pressed -> Zoom IN OUT
|
||||||
|
if ((VScroll || HScroll) && (ModifierKeys & Keys.Control) == Keys.Control)
|
||||||
{
|
{
|
||||||
VScroll = false;
|
VScroll = false;
|
||||||
HScroll = false;
|
HScroll = false;
|
||||||
base.OnMouseWheel(e);
|
base.OnMouseWheel(e);
|
||||||
VScroll = true;
|
VScroll = true;
|
||||||
HScroll = true;
|
HScroll = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Vertical Scoll with SHIFT key pressed
|
//Vertical Scoll with SHIFT key pressed
|
||||||
if (VScroll && (ModifierKeys & Keys.Shift) == Keys.Shift )
|
if (VScroll && (ModifierKeys & Keys.Shift) == Keys.Shift)
|
||||||
{
|
{
|
||||||
VScroll = false;
|
VScroll = false;
|
||||||
base.OnMouseWheel(e);
|
base.OnMouseWheel(e);
|
||||||
VScroll = true;
|
VScroll = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
base.OnMouseWheel(e);
|
base.OnMouseWheel(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue