![]() |
Tipp 0095
|
Scroll-Text
|
 |
|
Autor/Einsender: Datum: |
|
Klaus Brädler 12.07.2001 |
|
Entwicklungsumgebung: |
|
VB 5 |
|
|
Mit Hilfe von 2 PictureBoxen, der API-Funktion StretchBlt und eines Timers ist es möglich einen Scrolltext zu erstellen, der sich auch noch in der Geschwindigkeit, wie im Downloadbeispiel sehr schön dargestellt, verändern lässt.
|
|
Code im Codebereich des Moduls |
|
|
Option Explicit
Public Declare Function StretchBlt Lib "gdi32" (ByVal hDC _
As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth _
As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, _
ByVal XSrc As Long, ByVal YSrc As Long, ByVal nSrcWidth _
As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Public Const SrcCopy = &HCC0020
|
|
|
Code im Codebereich der Form |
|
|
Option Explicit
Public StartChar As Integer
Public CharWidth As Integer
Public TextLength As Integer
Public StartX As Long
Private Sub Form_Load()
StartChar = 1
Picture2.Print Mid(Scroll.Text, StartChar)
End Sub
Private Sub Text1_Change()
Timer1.Interval = Val(Text1.Text)
End Sub
Private Sub Timer1_Timer()
StretchBlt Picture1.hDC, 0, 0, Picture1.ScaleWidth, _
Picture1.ScaleHeight, Picture2.hDC, StartX, 0, _
Picture1.ScaleWidth, Picture1.ScaleHeight, SrcCopy
If StartX > Picture2.TextWidth(Mid(Scroll.Text, _
StartChar, 1)) - 2 Then
StartChar = StartChar + 1
StartX = 0
Picture2.Cls
Picture2.Print Mid(Scroll.Text, StartChar)
End If
StartX = StartX + 1
DoEvents
End Sub
|
|
|
|
|
Windows-Version |
95 |
 |
|
98/SE |
 |
|
ME |
 |
|
NT |
 |
|
2000 |
 |
|
XP |
 |
|
Vista |
 |
|
Win
7 |
 |
|
|
VB-Version |
VBA 5 |
 |
|
VBA 6 |
 |
|
VB 4/16 |
 |
|
VB 4/32 |
 |
|
VB 5 |
 |
|
VB 6 |
 |
|
|
|
Download (2,6 kB)
|
Downloads bisher: [ 2555 ]
|
|
|