I have a custom TrackBar
control from Devexpress
DevExpress.XtraEditorsTrackBarControl
I need to fire some long running Background operation on an image based on the selected value of the TrackBar
. But during the selection/dragging process the event should not be fired 20 times for an interval of 20, it should be only fired at the final position.
Currently I follow the following approach
private void trackBar1_MouseUp(object sender, EventArgs e)
{
value+= trackBar1.Value;
if ((value> 0) && (newvalue != oldvalue))
{
longworker.RunWorkerAsync();
oldvalue = newvalue;
}
}
private void trackBar1_EditValueChanged(object sender, EventArgs e)
{
newvalue = trackBar1.Value;
}
This works well, but the user needs to move the mouse out of the control for the event to fire.
Is there a way to get around this?
This answer: https://stackoverflow.com/a/9221091/848968 provides an approach, but the custom control does not have a scroll event.