I had this problem only now when I implement the built-in video player and I want the user to be able to change the position of the video, but I did not want to overload the video playback API by sending his SetPosition calls to every tick that the user went along the way to his final destination .
This is my decision:
First, the arrow keys are a problem. You can do your best to process the arrow keys through a timer or some other mechanism, but I found more pain than it costs. Therefore, set the SmallChange and LargeChange property to 0, as indicated in @Matthias.
To enter the mouse, the user will have to click, move and release it so that it handles the MouseDown, MouseUp and Scroll events for the trackpad as follows:
private bool trackbarMouseDown = false; private bool trackbarScrolling = false; private void trackbarCurrentPosition_Scroll(object sender, EventArgs e) { trackbarScrolling = true; } private void trackbarCurrentPosition_MouseUp(object sender, MouseEventArgs e) { if (trackbarMouseDown == true && trackbarScrolling == true) Playback.SetPosition(trackbarCurrentPosition.Value); trackbarMouseDown = false; trackbarScrolling = false; } private void trackbarCurrentPosition_MouseDown(object sender, MouseEventArgs e) { trackbarMouseDown = true; }
Fry guy
source share