Scrollender Text

Morgen,

ich habe vor kurzen einen tollen VB Code gefunden mit dem ich einen scrollenden Text erzeugen kann.

Hier dazu einmal den Quelltext:

_Add the following code to the General
Declarations section of Form1 (note that
the Declare statement must be typed as a
single line of code):
Const SRCCOPY = &HCC0020
Const ShowText$ = „This line of text scrolls vertically.“
Private Declare Function BitBlt Lib „GDI32“ (ByVal hDestDC As Integer, ByVal X
As Integer, ByVal Y As Integer, ByVal nWidth As Integer, ByVal nHeight
As Integer, ByVal hSrcDC As Integer, ByVal XSrc As Integer, ByVal YSrc
As Integer, ByVal dwRop As Long) As Integer
Dim ShowIt%

Add a Picture Box control to Form1.
Picture1 is created by default. Set its
ScaleMode property to 3-Pixel.

Add a Timer control to Form1. Timer1 is
created by default. Set its Interval
property to 25.

Add the following code to the Timer event
for Timer1 (note that the Ret = line must
be typed as a single line of code):
Private Sub Timer1_Timer()
Dim Ret As Integer
With Picture1
If (ShowIt% = 30) Then
.CurrentX = 0
.CurrentY = .ScaleHeight - 30
.Print ShowText$
ShowIt% = 0
Else
Ret = BitBlt(.hDC, 0, 0, .ScaleWidth,
.ScaleHeight - 1, .hDC, 0, 1, SRCCOPY)
ShowIt% = ShowIt% + 1
End If
End With
End Sub_

Mein Problem ist der fett markierte Teil im Code. Das PictureBox Steuerelemt hat keine Funktion „print“.

Wie kann ich in einer PictureBox einen Text ausgeben?

Danke
Michael Schieferer

Mein Problem ist der fett markierte Teil im Code. Das
PictureBox Steuerelemt hat keine Funktion „print“.

Wie kann ich in einer PictureBox einen Text ausgeben?

Du kannst die .Print() Methode trotzdem verwenden, obwohl sie nicht in der „Auflistung“ aufscheint - einfach trotzdem hinschreiben. z.B.:

Picture1.Print "Das ist ein Test"

Wichtig: vorher das AutoRedraw Property auf True setzen!!

greets from michL (vienna)

Danke, aber
Danke es war das Problem mit AutoRedraw!

Nun habe ich aber einen anderen Fehler und zwar einen Overflow in dem:

 Ret = BitBlt(.hDC, 0, 0, .ScaleWidth, \_
 .ScaleHeight - 1, .hDC, 0, 1, SRCCOPY)

Bereich :frowning:! Was tun sprach Zeus…

[Bei dieser Antwort wurde das Vollzitat nachträglich automatisiert entfernt]

Nun habe ich aber einen anderen Fehler und zwar einen Overflow
in dem:

Ret = BitBlt(.hDC, 0, 0, .ScaleWidth, _
.ScaleHeight - 1, .hDC, 0, 1, SRCCOPY)

Bereich :frowning:! Was tun sprach Zeus…

Zeus empfielt die Variable Ret mit ‚As Long‘ zu deklarieren (falls diese mit ‚As Integer‘ deklariert sein sollte) - ansonsten ist ‚er‘ ratlos!

Auch wenn die Variable RET als LONG deklariert ist kommt der OVERFLOW!

Weiß keiner eine Alternative (oder eine fehlerfrei version meines codes?)

[Bei dieser Antwort wurde das Vollzitat nachträglich automatisiert entfernt]