Results 1 to 6 of 6

Thread: [VB 2005] Scrolling Text - Right To Left

  1. #1

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    [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

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    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...

  3. #3

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    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

  4. #4
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    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
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  5. #5
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    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.

  6. #6
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    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.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width