Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect : scrolling - up or down?

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?

like image 412
Ilya Blokh Avatar asked May 01 '10 12:05

Ilya Blokh


2 Answers

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

like image 80
M.A. Hanin Avatar answered Oct 08 '22 01:10

M.A. Hanin


private void dgv_Scroll(object sender, ScrollEventArgs e)
        {
            if (e.OldValue > e.NewValue)
            {
                // here up
            }
            else
            {
                // here down
            }
        }
like image 40
Mena Dawoud Avatar answered Oct 08 '22 02:10

Mena Dawoud