I have a panel in winform. I want to capture both scroll and mouse wheel event for the panel. For both scenario I want to check the scroll bar position.
When scroll bar is at bottom (at the end of scrolling...) the control should fire the event.
I have done this for Panel.Scroll like this:
private void Panel1_Scroll(object sender, ScrollEventArgs e)
{
if (e.NewValue == Panel1.VerticalScroll.Maximum - Panel1.VerticalScroll.LargeChange+1)
{
//do some operation
}
}
But for MouseEventArgs there is no value (e.newvalue) to indicate scrollbar position.
How can I get the Scrollbar position from mouse wheel event ?
Also as per my requirement both event call have same logic implementation, so I want to write the logic once.
How can I achieve this ?