How to detect : scrolling - up or down?

2020-02-14 05:46发布

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?

3条回答
Ridiculous、
2楼-- · 2020-02-14 06:09

Use the passed System.Windows.Forms.ScrollEventArgs arguments' OldValue and NewValue properties to detect the scroll direction.

查看更多
老娘就宠你
3楼-- · 2020-02-14 06:18
private void dgv_Scroll(object sender, ScrollEventArgs e)
        {
            if (e.OldValue > e.NewValue)
            {
                // here up
            }
            else
            {
                // here down
            }
        }
查看更多
走好不送
4楼-- · 2020-02-14 06:19

Checkout ScrollEventArgs Class and this answer.

查看更多
登录 后发表回答