I have a winform application where I want a event to be fired when the scrollbar reaches the bottom of panel.
I tried this:
private void Panel1_Scroll(object sender, ScrollEventArgs e)
{
//some operation
}
But it is firing event everytime I scroll the Scrollbar not when I reach the end.
How to achieve this ?
Check ScrollEventArgs.NewValue
Property. Like this:
private void Panel1_Scroll(object sender, ScrollEventArgs e)
{
if (e.NewValue == panel1.VerticalScroll.Maximum - panel1.VerticalScroll.LargeChange + 1)
{
if(e.NewValue != e.OldValue) // Checking when the scrollbar is at bottom and user clicks/scrolls the scrollbar
{
MessageBox.Show("Test"); // Some operation
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With