Good morning,
I contact cause I made my own user control to create a spin box. The spin box has two buttons for increase and decrease the value. I would like to create an event in order to increase or decrease the value (depend the case) when I stayed cliked, in continous, on the button. It is not the only click on the button it it is when I stay the left button down and the value continue to increase automatically.
Do someone know the name of the event I have to used ? I tried "PreviewMouseLeftButtonDown" but it gives the same behavior than a "Click".
Thank you in advance for your answer.

Shweta LodhaRank #31 · 39.8K reputationPosted Jun 4, 2014, 1:24 AM EDT
You can achieve this by using Timer. Please have a look at this sample code:
private void incrementbutton_MouseDown(object sender, MouseEventArgs e)
{
timer1.Enabled = true;
timer1.Start();
}
private void incrementbutton_MouseUp(object sender, MouseEventArgs e)
{
timer1.Stop();
}
private void timer1_Tick(object sender, EventArgs e)
{
// increment your counter here
}
Romain90 reputationPosted Jun 4, 2014, 6:10 AM EDT
Shweta LodhaRank #31 · 39.8K reputationPosted Jun 4, 2014, 8:28 AM EDT