(hopefully the next piece of code is bug-free, no VB here, sorry)
Drop a picturebox on your form.
Name: picBackground
Picture: Your background image
AutoSize: True
AutoRedraw: True
ScaleMode: vbPixels
Font: Whatever font you want to use
Also drop a timer on your form:
Name: tmrScroll
Interval: 100 (experiment with this, unfortunately, the timer practically won't go lower than 50, or 10 on Windows NT)
Enabled: True
In the General -> Declarations of your form:
VB Code:
Private lXPos As Long Private Message As String
Form_Load:
VB Code:
Sub Form_Load() lXPos = picBackground.ScaleWidth Message = "Ain't that cute!" End Sub
tmrScroll_Timer:
VB Code:
Sub tmrScroll_Timer() ' Move text (change -1 for faster movement) lXPos = lXPos - 1 If lXPos < picBackground.TextWidth(Message) Then lXPos = picBackground.ScaleWidth ' Clear the picturebox picBackground.Cls ' Draw the text picBackground.CurrentX = lXPos picBackground.CurrentY = (picBackground.ScaleHeight - picBackground.TextHeight(Message)) / 2 picBackground.Print(Message) ' Display changes picBackground.Refresh End Sub
Now that's the non-API way, you could also replace CurrentX, CurrentY and Print with the TextOut API, but I don't know the declaration, and this should also work theoretically
Note that when you are going to use the API, ScaleMode has to be Pixels, so just in case I already let you set it
Hope that helps...






Reply With Quote