CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 20

Threaded View

  1. #1
    Join Date
    Mar 2007
    Posts
    274

    [RESOLVED] How to raise event trapping mouse wheel scroll?

    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

    Code:
     
    privatevoid KeystrokesDetails_MouseMove(object sender, MouseEventArgs e)
    {
    OnMouseActivity(this, e);
    }
    as well.......


    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....

    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;
    }
    }
    This doesnt work. Delta is always 0. How can I isolate the Delta value?
    Last edited by Traps; April 24th, 2007 at 11:18 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured