In C# you could add a timer and do something like this
int position = 0;
private void button1_MouseDown(object sender, MouseEventArgs e)
{
timer1.Start();
}
private void button1_MouseUp(object sender, MouseEventArgs e)
{
timer1.Stop();
}
private void timer1_Tick(object sender, EventArgs e)
{
position++;
}
Then every tick of the timer will set the position.
You will have to change the code to something you could use,
but you get the big picture here.