AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 
This Site
 Search Engine
 Contact Form
 

Donate to AllAPI.net

Scroll Text Vertically on Picture Box

If you want to scroll text vertically, all you need is a timer, a picturebox and the BitBlt API function. Put the following in the declare section of a form:

Declarations

Const SRCCOPY = &HCC0020
Const ShowText$ = "This line of text scrolls vertically."

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

Dim ShowIt%      

Code

Add a picturebox to the form and set its scalemode to pixel (3). Add a timer to the form with an interval of about 25. Now put this code in the timer's
timer event:

Private Sub Timer1_Timer()

Dim Ret As Integer

If (ShowIt% = 100) Then 'play with this value for desired effect
    Picture1.CurrentX = 0
    Picture1.CurrentY = Picture1.ScaleHeight - 15 'play with this also
    Picture1.Print ShowText$
    ShowIt% = 0
Else
    Ret = BitBlt(Picture1.hDC, 0, 0, Picture1.ScaleWidth, _
    Picture1.ScaleHeight - 1, Picture1.hDC, 0, 1, SRCCOPY)
    ShowIt% = ShowIt% + 1
End If     

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at http://allapi.mentalis.org/