Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scrolling text using vb

Status
Not open for further replies.

Grafixanat

Technical User
Aug 26, 2001
3
US
this code works....but if I try and extend the length of the text message.....it stops. How do I make this code accept a longer text line that scrolls?



Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC 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 dwRop As Long) As Long
Const speed As Byte = 1
Dim wid%
Dim hei%
Dim dc&
Const text = " HELLO WORLD!!! "
Private Sub Form_load()

dc = Picture1.hDC

Picture1.CurrentX = 0
Picture1.CurrentY = 0
Picture1.Print text
Picture1.ScaleMode = vbPixels
wid = Picture1.TextWidth(text)
hei = Picture1.TextHeight(text)
Picture1.Width = wid * Screen.TwipsPerPixelX
Picture1.Height = hei * Screen.TwipsPerPixelY
End Sub


Private Sub Timer1_Timer()
Dim i%


For i = 0 To speed

BitBlt dc, wid + 1, hei + 1, 1, hei, dc, 0, 0, &HCC0020 ' &hcc0020 is equvilent to vbSrcCopy
BitBlt dc, 0, 0, wid, hei, dc, 1, 0, &HCC0020
BitBlt dc, wid, 0, 1, hei, dc, wid + 1, hei + 1, &HCC0020

Next i
Picture1.Refresh


End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top