Comments (6)
Hello,
Thanks for the comment. The issue you refer to was closed and so wasn't visible without searching, but it was #9
However, it's a perfectly reasonably suggestion to implement and given that you're now the third person to ask for it (and truth to tell, I could do with it in one of my core products as well), it makes perfect sense to implement it in the base control.
Assuming I don't get a PR in the next couple of days, I'll look at adding this as a core feature at the weekend.
Thanks again for the feedback!
Regards;
Richard Moss
from cyotek.windows.forms.imagebox.
I realize it has been a couple years since this was touched, but is there any pointers on how we could approach this? I see there is a protected property called WheelScrollsControl, but I can see no use of it in the control. I have tried to override the MouseWheel event, but I am not sure how to wire it to the ScrollControl class. This functionality is definitely needed.
from cyotek.windows.forms.imagebox.
So I think I got a workaround for now. I did the following:
- Inherit the control.
- Expose the WheelScrollsControl property as public.
- Override the MouseWheel event, using the WheelScrollsControl property, and execute the scroll code that is found in the base ScrollControl.cs (had to copy it). Otherwise run control's base.
/// <summary>
/// Raises the <see cref="System.Windows.Forms.Control.MouseWheel" /> event.
/// </summary>
/// <param name="e">
/// A <see cref="T:System.Windows.Forms.MouseEventArgs" /> that contains the event data.
/// </param>
protected override void OnMouseWheel(MouseEventArgs e)
{
if (this.WheelScrollsControl == true)
{
int x;
int y;
int delta;
x = this.HorizontalScroll.Value;
y = this.VerticalScroll.Value;
// TODO: Find if we are hovering over a horizontal scrollbar and scroll that instead of the default vertical.
if (this.VerticalScroll.Visible && this.VerticalScroll.Enabled)
{
if (ModifierKeys == Keys.Control)
{
delta = this.VerticalScroll.LargeChange;
}
else
{
delta = SystemInformation.MouseWheelScrollLines * this.VerticalScroll.SmallChange;
}
y += (e.Delta > 0) ? -delta : delta;
}
else if (this.HorizontalScroll.Visible && this.HorizontalScroll.Enabled)
{
if (ModifierKeys == Keys.Control)
{
delta = this.HorizontalScroll.LargeChange;
}
else
{
delta = SystemInformation.MouseWheelScrollLines * this.HorizontalScroll.SmallChange;
}
x += (e.Delta > 0) ? -delta : delta;
}
this.ScrollTo(x, y);
}
else
{
base.OnMouseWheel(e);
}
}
Seems to be doing the trick, and was simple enough.
from cyotek.windows.forms.imagebox.
Hello,
Thanks for the comment, I'm glad you found a solution that works for you. It has been some time since I worked on this control and I've complete forgotten what state it currently in is. Despite that, it's by no means abandoned (I use it in a fair few of my projects), I just don't have time to work on this because of other commitments where users are perhaps... more vocal with their displeasure (to put it mildly).
From what I remember though, this approach won't work in the branch I'd been working on to revamp the control as the ScrollControl
that the WheelScrollsControl
property belongs to was removed as part of a general clean up and simplification.
I don't think I got around to adding this functionality but I do intend on adding it. No promises as I think I've broken pretty much every promise or timescale on the open source code but I'll at least dig out which branch I'm supposed to be working on and try and figure out where I am and jot down some form of plan.
Regards;
Richard Moss
from cyotek.windows.forms.imagebox.
@cyotek No worries. Because I merely inherited the control with just my few modifications, I am pretty sure I should be able to either revert to your updated one (when and if you choose to release) or adapt my inherited control. Thanks for the work you put into this project over the years. It is still the fastest full-featured open source image box out there. We are using the Gnostice image viewer for some use cases, and your control leaves it in the dust in terms of responsiveness and memory usage.
from cyotek.windows.forms.imagebox.
I've created a pull request facing this by adding a property for the mouse wheel mode:
#48
from cyotek.windows.forms.imagebox.
Related Issues (20)
- VirtualDraw and Scale\Transform HOT 2
- Swipe support? HOT 2
- Wrong selection area when maximizing HOT 2
- Creating and Zooming Graphics
- How to determinate a pixel in the imageBox (Mouse click) with total precision HOT 1
- How to get image Point use mouse position? HOT 1
- Solution to: Exception 'Out of Memory' while drawing a big image HOT 2
- Unable to Crop image HOT 1
- Add ability for transparent background color to be used
- Image graphics disappear when zooming out HOT 2
- Is this project still maintained? What about the nuget package? HOT 2
- Support. Net 5.0 HOT 2
- Wrong scrolling in CanPan method HOT 4
- How to save viewport as bitmap? HOT 1
- Π‘an't distinguish click and panning event HOT 1
- The image has moire patterns when scale 15% HOT 3
- Use 2 ImageBoxes side by side
- Gap bug with foreground color HOT 1
- There isn't a way to disable scrollbar HOT 2
- Keep painted drawing on Imagebox after zoom or pan HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cyotek.windows.forms.imagebox.