I cant seem to figure out how to raise an event that will pass the delta value for mouse scroll from a user control to main form.
I see that MouseEventArgs has delta as one of its properties. With that in mind I have defined
publiceventMouseEventHandler OnMouseActivity;
in my user control, and raise the event
as well.......Code:privatevoid KeystrokesDetails_MouseMove(object sender, MouseEventArgs e) { OnMouseActivity(this, e); }
In my main program, immediately after I create an instance of the user control(the user control is added to a split container panel2 controls collection), I set up the event like this ..........
newDetails.OnMouseActivity += newMouseEventHandler(MouseMoved);
and have a method programmed to handle the event....
This doesnt work. Delta is always 0. How can I isolate the Delta value?Code:privatevoid MouseMoved(object sender, MouseEventArgs e) { if (e.Delta == 120) { splitContainer2.Panel2.VerticalScroll.Value += splitContainer2.Panel2.VerticalScroll.SmallChange; } else if (e.Delta == -120) { splitContainer2.Panel2.VerticalScroll.Value += splitContainer2.Panel2.VerticalScroll.SmallChange; } }




Reply With Quote