Tuesday, October 5, 2010

Using Visual Basic's Timer control



Visual Basic provides a Timer control, which is essentially a set interval of time triggered procedures so that we can hide in the system to a time interval trigger procedures. The flexibility to use it can get very subtle effects.

Below, we give an example.

We can design the interface design of such an effect: a line of text in the form of gradually rolling from left to right, from the right "roll out" the form of text, then left to emerge. So the cycle continues. Information similar to the rolling television. This will allow you to design the software looked very lively and can easily cause the user's interest. In fact, the use of Visual Basic's Timer control can easily achieve it.

First, we set in the form of two Label controls Label1, Label2. Left control, in addition to the two properties, other properties set to the same. This is mainly to achieve the effect of rolling cycle. Their Caption property to display the text to scroll. Also re-adjust its font, size and color. In the Form-Load process set Label2. Left =- 6240 (Form width), Label1. Left = 0. This will ensure that La 顎?bel1 part of the "rolling" out of form, then part of the entry form Label2. Rolling circle formed in the form set? / FONT> Timer control. Timer control's Interval property determines the speed of rolling, in milliseconds.

For example, we set to 300, then roll once every 0.3 seconds.

Then, in the Timer1-Timer () process by adding the following procedures:

Private Sub Timer1-Timer ()
Label1. Left = Label1. Left +50
Label2. Left = Label2. Left +50
If Label1. Left> = 6240 Then
Label1. Left =- 6240
End If
If Label2. Left> = 6240 Then
Label2. Left = 6240
End If
End Sub

Rolling effect on the form, the interested reader can try. As long as the flexible use Timer control, we can design a more interesting effect. Timer control with control buttons, such as control of the Visible property to form a flashing button. Timer control with the control to display different images to form a simple animation.







相关链接:



U buy four UNIQUE skill set



brief Web Or Video CAMS



How To Revive The Old Floppy Drive?



ICP LICENSE issue processing



Expert Games Arcade



Adobe "culmination of the track" Result of Contest winners



Qualcomm CEO: WiMax 3G will compete in the face of setbacks



3GP to MOV



New Source Editors



ASP test TWO simple functions external to submit



TRANSPORT Stream converter



Chen Zhou Reflect years of business success: The greatest scar has not come yet



internal audit in the modern enterprise risk



MTS To AVI



No comments:

Post a Comment