'=========================================================================== ' Subject: SMOOTHER CONTROL ANIMATION Date: 02-12-99 (14:34) ' Author: Eric Bernatchez Code: VBWIN ' Origin: CapeCanaveral/Lab/1961/ Packet: VBWIN.ABC '=========================================================================== Smoother Control Animation If you ever tried making a Label scroll from the right side to the left side of the screen, you know how bad the result is. A traditional approach of doing so would be: Public Sub Scrolling() Label1.Left = Screen.Width Do Label1.Left = Label1.Left - 15 ' 15 is the equivalent of 1 pixel DoEvents Loop Until Label1.Left <= -(Label1.Width + 15) End Sub VB makes too many redraws in a small period of time, so you can hardly read the text of the Label. The solution is to slightly increase the duration of each appearance of the Label so the human eye has enough time to see it. To obtain the same scrolling speed, you must increase the steps of the Label from 15 to 30, or even 60. Here's how to do it: Public Sub Scrolling() Label1.Left = Me.Width Do Label1.Left = Label1.Left - 60 temp = Timer Do DoEvents Loop Until Timer - temp > 0.1 Loop Until Label1.Left <= -(Label1.Width + 15) End Sub Doing so also makes the animation independent of the CPU's speed. Eric Bernatchez, Montreal, Quebec, Canada