[VB 2005] Scrolling Text - Right To Left
Created some scrolling text, can be used for news bulletins, announcements etc.
You need:
Label - name: label1
Timer - name: timscroll - interval: 10 - enabled: true
Code:
Private Sub timscroll_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timscroll.Tick
If Label1.Left = 0 - Label1.Width Then
Label1.Left = Me.Width
Label1.Left = Label1.Left - 1
Else
Label1.Left = Label1.Left - 1
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Left = Me.Width
End Sub
Hope It Helps! :)
-----
knxrb
Re: [VB 2005] Scrolling Text - Right To Left
Cool... But what if I don't want to move the label since it may runs over my other controls on the form? In essence, I want the label's location to stay fixed while the text inside it scrolls... :)
Re: [VB 2005] Scrolling Text - Right To Left
I'll look into it and see if I can get it to do that :)
I'll reply when I find an answer.
------
KNXRB
Re: [VB 2005] Scrolling Text - Right To Left
if you want the label to remain fixed while the text is scrolling, you'll need to look into GDI+ for drawing strings
Re: [VB 2005] Scrolling Text - Right To Left
Quote:
Originally Posted by JuggaloBrotha
if you want the label to remain fixed while the text is scrolling, you'll need to look into GDI+ for drawing strings
Not neccesarily... You can use string.substring to remove a character at one end and append it back at the other end of the string.
Re: [VB 2005] Scrolling Text - Right To Left
Quote:
Originally Posted by stanav
Not neccesarily... You can use string.substring to remove a character at one end and append it back at the other end of the string.
Yes, that part was assumed in my previous post.