Re: Scrolling text in a stationary label help needed




.. . . and here's another one. Basically it's exactly the same as the last one, but it has a better message ;-)

(Remember to set a reference to DirectX7)

Mike

Option Explicit
Private objDX As New DirectX7
Private objDD As DirectDraw7

Private Sub Form_Load()
Set objDD = objDX.DirectDrawCreate("")
End Sub

Private Sub Command1_Click()
Dim stext As String
Dim wide As Long, xposition As Long
Me.ScaleMode = vbPixels
Me.Width = Screen.Width * 0.95
With Picture1
.BorderStyle = vbFixedSingle
.AutoRedraw = True
.ScaleMode = vbPixels
.FontName = "Times New Roman"
.FontSize = 16
.FontBold = True
.Cls
stext = "Rum and Coke® is a wonderful drink - but it needs "
stext = stext & "to be dark rum and definitely not diet Coke®."
.Move 0, 10, .TextWidth(stext), .TextHeight(stext) + 6
stext = stext & Space$(12)
End With
Do
wide = Picture1.TextWidth(Left$(stext, 1))
For xposition = 0 To 1 - wide Step -1
Picture1.Cls
Picture1.CurrentX = xposition
Picture1.Print stext;
objDD.WaitForVerticalBlank DDWAITVB_BLOCKBEGIN, ByVal 0
DoEvents
Next xposition
stext = Mid$(stext, 2) + Left$(stext, 1)
Loop
End Sub






.



Relevant Pages

  • Re: Scrolling text in a stationary label help needed
    ... Dim xposition As Long ... Dim stext As String ... Private Sub Form_KeyPress ...
    (microsoft.public.vb.general.discussion)
  • Re: Scrolling text in a stationary label help needed
    ... In your VB project you need to use the Project / References menu and set a reference to "DirectX7 for Visual Basic Type Library". ... The text should scroll at more or less the same rate as the previous version (or perhaps slightly slower or faster, depending on your video frame rate) but it should be very much smoother than before. ... Private Sub Command1_Click ... Dim stext As String ...
    (microsoft.public.vb.general.discussion)
  • Re: Scrolling text in a stationary label help needed
    ... Any idea how to modify it so the label ... It would of course make sense to have its height set to a value that is at least as high as the text of course, which depends on the size of the font you wish to use. ... Private Sub Command1_Click ... Dim stext As String ...
    (microsoft.public.vb.general.discussion)
  • Re: Line continuation
    ... "Randy Birch" wrote: ... Private Sub TextEffect(ByVal sText As String, ByVal lX As Long, ByVal lY As ...
    (microsoft.public.vb.general.discussion)
  • Re: MailItem SaveAs method
    ... Private Sub WriteFile(sPath As String, ... sText As String, _ ... ByVal bAppend As Boolean _ ...
    (microsoft.public.outlook.program_vba)