开发者

How to detect : scrolling - up or down?

开发者 https://www.devze.com 2022-12-29 07:29 出处:网络
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 thi开发者_运维技巧s?Use the passed System.Windo

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 thi开发者_运维技巧s?


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


private void dgv_Scroll(object sender, ScrollEventArgs e)
        {
            if (e.OldValue > e.NewValue)
            {
                // here up
            }
            else
            {
                // here down
            }
        }


Checkout ScrollEventArgs Class and this answer.

0

精彩评论

暂无评论...
验证码 换一张
取 消