|
-
Jun 30th, 2000, 12:21 PM
#1
Thread Starter
Hyperactive Member
How can I scroll text? Do I need to use BitBlt? Is there a control that does this already?
I would like to create text that would scroll from right to left across my form, sorta like a stock quote ticker.
-
Jun 30th, 2000, 12:33 PM
#2
i did it once with a timer and Courier-New font, i just incremented the 'start' argument of an INSTR() function, and sent that clip of text to a label.
It isn't the smoothest but at least the letters jump along at a uniform pace!
-
Jun 30th, 2000, 12:37 PM
#3
_______
...a couple of examples
example 1
'scrolling text
'need 1 label, 1 timer, 1 command button for this example
'
Option Explicit
Private Sub Command1_Click()
'will give user a Yes or No prompt in which they wish to exit
Dim x As Integer
x = MsgBox("Are you sure you want to exit?", vbYesNo, "Exit")
If x = 6 Then
End
End If
End Sub
Private Sub Form_Load()
'Will modify all the following controls when the project is run o
' r loaded
dim msg$ as string
msg$ = "This is a simple Marquee example that I've made." & vbCrLf
msg$ = msg$ & "You can make something 100 times better."
MsgBox msg$, vbYes, "Marquee Example of Scrolling Text"
Label1.Visible = True
Label1.Enabled = True
Form1.Enabled = True
Label1.Caption = Date
Label1.Left = 0
Label1.Top = 1800
Label1.Height = 255
Label1.Width = 1195
Command1.Top = 2400
Command1.Left = 0
Command1.Height = 375
Command1.Width = 6705
Command1.Caption = "Exit Example"
Command1.Enabled = True
Command1.Visible = True
Form1.Height = 3225
Form1.Width = 6810
Timer1.Enabled = True
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
If Label1.Left < -1000 Then
Label1.Left = 7000
Else
Label1.Left = Val(Label1.Left) - 40
End If
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''
'example 2
'scrolling text...
'scrolls once from the bottom of the picture box
'to the top of the box
' requires a picture box and a timer control
'(timer ctrl propery enabled set to false)
'
Option Explicit
'
'Text string to be scrolled
Public strString As String
'Last position of text
Public IntLPosition As Integer
Private Sub Form_Load()
'
'strString = the text you want scrolled
'
strString = "This is a scrolling text example." & vbCrLf
strString = strString & "The life and times of me!" & vbCrLf
strString = strString & "As if there was a tale." & vbCrLf
strString = strString & "Who, but you, would you tell it to?"
'
IntLPosition = Picture1.Height 'Start at bottom
Timer1.Interval = 50 'time between scrolling (lower number faster speed)
Timer1.Enabled = True 'Start timer
'
End Sub
Private Sub Timer1_Timer()
Picture1.Cls 'Clear picture box
Picture1.CurrentY = IntLPosition 'Set position
Picture1.Print strString 'Show
IntLPosition = IntLPosition - Screen.TwipsPerPixelY 'Move up one pixel
If IntLPosition < 0 Then Timer1.Enabled = False 'Stop when at top
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jun 30th, 2000, 01:36 PM
#4
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|