System.Windows.Forms.Form has only one scroll event-Scroll, but it is necessary to recognize scrolling up and scrolling down.Could you tell me,how to do this?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Use the passed System.Windows.Forms.ScrollEventArgs arguments' OldValue and NewValue properties to detect the scroll direction.
回答2:
private void dgv_Scroll(object sender, ScrollEventArgs e)
{
if (e.OldValue > e.NewValue)
{
// here up
}
else
{
// here down
}
}
回答3:
Checkout ScrollEventArgs
Class and this answer.