0

We have a slider in our C# WinForms application. We update some other information on the UI when the Scroll event occurs. However, when setting the Value property, we only notice the slider changes visually and the ValueChanged event occurs.

It works when using record/playback, but that depends on mouse coordinates.

How can I "scroll" reliably without depending on mouse coordinates?

Here's my form in its default size:

Slider small

and it works with this recording:

Ranorex Recording

but it stops working reliably as soon as the form is resized:

Slider large

I'm looking for a method to drag the slider from value 0 to value 3, independent of the size of the slider.

I can set the value of the slider in a code module like this:

void ITestModule.Run()
{
    Mouse.DefaultMoveTime = 300;
    Keyboard.DefaultKeyPressTime = 100;
    Delay.SpeedFactor = 1.0;

    SliderTestRepository.Instance.Form1.TrackBar1.Value = 3;
}

but this will only change the position of the slider and not fire the scroll events.

  • Can we see what you've tried so far to achieve this? – IAmMilinPatel Sep 27 '16 at 3:31
  • @TESTasy: sure. See my updated question. It's easily reproducible, since I'm still in evaluation and do not work on a real application yet. – Thomas Weller Sep 27 '16 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.