Reputation: 8548
I would like to know how to use the scroll event handler in Datagridview
. I have a very big table of around 20 columns. It would fit in the screen.
So, when I scroll in the horizontal direction, when a particular column go out of focus, I need to call some function.
Any idea, how to achieve it ?
Something similar :
private void datagridview_Scroll(object sender, ScrollEventArgs e)
{
//If namecol go out of focus
//foo();
}
Upvotes: 0
Views: 4814
Reputation: 8548
Here is what I did :
private void datagridview_Scroll(object sender, ScrollEventArgs e)
{
if (e.ScrollOrientation == ScrollOrientation.HorizontalScroll)
{
if (e.NewValue > this.check1.Width/2 )
foo();
else
hoo();
}
}
Thanks
Upvotes: 2