I am trying to implement the ScrollEventHandler and I keep getting the following error:
Cannot implicitly convert type 'System.Windows.Forms.ScrollEventHandler' to 'System.EventHandler'
Here is my code:
zoomBar.Scroll = new ScrollEventHandler(this.zoomBar_Scroll);
And here is the method:
private void zoomBar_Scroll(object sender, ScrollEventArgs e)
{
if ( e.OldValue > e.NewValue)
{
wChart.zoomMinus();
}
else
{
wChart.zoomPlus();
}
}
I think this matches exactly what is in the Microsoft documentation but I must be missing something.
Here is a screenshot of the metadata for scroll
CodePudding user response:
Try this:
zoomBar.Scroll = (sender, e) =>
{
if (e.OldValue > e.NewValue)
{
wChart.zoomMinus();
}
else
{
wChart.zoomPlus();
}
};
CodePudding user response:
I got the scrollbar event and the trackbar event confused. ScrollEventsArgs goes with ScrollBar not TrackBar. But as someone pointed out in the comments there is a mistake in the documentation that indicates ScrollEventsArgs works with TrackBar but it does not.

