I attached the code example, which work okay but it use DoEvent() which
is bad programming practice.
private void XBtnZoomIn_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
SM.MouseZoomInX(SD.iZChOrder,SD.iWidth/2,120);
Application.DoEvents();
SC.Invalidate();
DateTime nextEvent = DateTime.Now.AddMilliseconds(dInitialDelay);
TimeSpan ts;
m_XIsZoomInDown = true;
while (m_XIsZoomInDown)
{
System.Threading.Thread.Sleep(5);
ts = nextEvent.Subtract(DateTime.Now);
if (ts.TotalMilliseconds <= 0)
{
SM.MouseZoomInX(SD.iZChOrder,SD.iWidth/2,120);
nextEvent = DateTime.Now.AddMilliseconds(dRepeatDelay);
SC.Invalidate();
}
Application.DoEvents();
}
}
}
private void XBtnZoomIn_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs e)
{
m_XIsZoomInDown=false;
}
What I try to do is to moinitor the change of the left mouse button so
I can quit the loop.