Creation anime running line
In this article we shall consider the example to realization of the effect àíèìàöèè running line . Use him(it) possible, for instance, as ñâîåîáðàçíóþ íàïîìèíàëêó , spurring user to register the program, or simply remove the name and version of the program (for effect), or, finally, as àíèìèðîâàííóþ a tape of the news of the program. Certainly, here it is necessary to know the measure to in vain not to irritate the user such àíèìèðîâàííîé by advertisment, otherwise can be an inverse result.
The Idea is taken beside Andreya Mitina. For begin are defined that we shall remove in line àíèìàöèè. As variant name and version of the program and reminder of need of the registrations. The Lines better to declare as global constants and variable in general module. In this case if You solve to use the effect of the runninging line in several forms then for change the text of the line it is enough will change importances of the constants.
lab.ForeColor =16711680 ‘ blue colour
For realization of the effect anime we shall show function with two parameters
Public Function StrAnime(Str As String, lbStr As Label)
Str – line, which remove
lbStr – element (Label) on form, in which is removed line anime
Public Function StrAnime(Str As String, lbStr As Label)
On Error GoTo Err_
Const iTrim As Long = 100 ' maximum width of the line (number sign, including gaps)
Dim sIntStr As String
Dim i As Long, j As Long
bStr.TextAlign = 1 ' we justify line
sIntStr = Str
Do While Len(sIntStr) < iTrim ' we spacefill begin line - before max of the number sign <= 100
sIntStr = " " & sIntStr
Loop
For i = Len(sIntStr) To 1 Step -1
lbStr.Caption = Mid(sIntStr, i) 'here strictly and occurs - "âûäâèæåíèå" line - show line, as from last symbol
DoEvents ' we shall send management a system
j = 1
Do While j < 1500000 ' but here simply counter - a variant of the time delay of the process
j = j + 1
Loop
Next i
For i = 1 To Len(sIntStr) ' line , now her(its) such image it is necessary to take away
lbStr.Caption = String(i, " ") & Mid(sIntStr, 1, Len(sIntStr) - i) ' we take away line - cut off symbols
DoEvents ' we shall send management a system
j = 1
Do While j < 1500000 ' counter
j = j + 1
Loop
Next i
Exit_:
Exit Function
Err_:
Resume Exit_
End Function
The Function anime has done, now her(its) it is necessary to start. We Use the characteristic of the form Timer. The Interval of the timer shall put(deliver) for instance 500. And shall insert the procedure:
Private Sub Form_Timer()
On Error GoTo Err_
lab.ForeColor = 0
StrAnime NomWers, Me.lab
lab.ForeColor = 255
StrAnime StrEnabled, Me.lab
Err_:
Exit Sub
End Sub
If You solve to use the considered effect an àíèìàöèè, that take into account that he in what that measure loads the system during time delay - after all happens to ãîíÿòü cycles íàêðóòêè. In the same way and velocity of the moving the line depends on system capacity: if machine considers quickly, that and line will in the same way fly.
The Example, as so much for works, You may ñêà÷àòü below.
Author: Admin
Size: 29 kB
It Is Added: 09.02.2007