First, you must use a stopwatch to determine the time you want.
using System.Diagnostics;
Second, define a global instance of the stopwatch class.
Stopwatch s = new Stopwatch();
This is the first event you should use:
private void controlName_MouseDown(object sender, MouseEventArgs e) { s.Start(); }
This is the second event you should use:
private void controlName_MouseUp(object sender, MouseEventArgs e) { s.Stop();
source share