Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse wheel values not returned to scroll event #3

Open
tomb18 opened this issue Feb 25, 2019 · 1 comment
Open

Mouse wheel values not returned to scroll event #3

tomb18 opened this issue Feb 25, 2019 · 1 comment
Assignees

Comments

@tomb18
Copy link

tomb18 commented Feb 25, 2019

Hi,
There is an issue with using a mouse wheel and the scroll event. The mouse wheel changes do not raise the scroll event as in a standard track bar. They do work with the value changed event. However, the value changed event is not a good choice since any changes to the trackbar will result in an event.
For example, the slider positions in my application are established by polling a radio for the values of particular functions. For example, I may poll the radio for the audio gain level. I then set the position of the audio gain slider. This is fine if you use the scroll event. On the other hand, if you use value changed you end in a loop where the control is updated, then a value changed event is generated and back and forth.
Where do I need to change this in the slider source? I have been unable to locate where this should be done?
Thanks, Tom

@fabricelacharme fabricelacharme self-assigned this Feb 26, 2019
@blackholeearth
Copy link

blackholeearth commented Oct 18, 2024

//to match winforms behavour scroll , you need to add 2 events.

form1_load()
{
    trackBar1.Scroll += trackBar1_Scroll;
    trackBar1.MouseWheel += trackBar1_Scroll;   /*  <----notice  */
}

private void trackBar1_Scroll(object sender, EventArgs e)
{
       var scrollmsg ="you have scrolled via msclick or key"
       var whellmsg ="you have scrolled via wheel"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants