Results 1 to 10 of 10

Thread: [RESOLVED] Scroll in VB (one more question!)

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2007
    Location
    Canada
    Posts
    297

    Resolved [RESOLVED] Scroll in VB (one more question!)

    Does anyone have a control or code to make scrolling text, like a scrolling marquee?

    I'd like to input text into a text box, press a command button and have the text scroll in a label or something.

  2. #2
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Scroll in VB

    Another example
    Code:
    Private Sub Timer1_Timer()
      Label1.Move Label1.Left - 25
      If Label1.Left < -Label1.Width Then Label1.Left = Picture1.Width
    End Sub
    
    Private Sub Form_Load()
    Label1.Caption = "This is an example of Marquee Scrolling Text Using A Label And A Picture Box"
    End Sub

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2007
    Location
    Canada
    Posts
    297

    Re: [RESOLVED] Scroll in VB (one more question!)

    I have the scroll enabled.. How ever it flickers something wicked, how can I fix this? I am using a label..

  5. #5
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: [RESOLVED] Scroll in VB (one more question!)

    can you post your scroll code here ?

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2007
    Location
    Canada
    Posts
    297

    Re: [RESOLVED] Scroll in VB (one more question!)

    Sure..

    Here it is:
    Code:
    LDL.Scroll.Move LDL.Scroll.Left - 50
    If LDL.Scroll.Left < -LDL.Scroll.Width Then LDL.Scroll.Left = LDL.Width
    "LDL" is the form that the label "Scroll" is on.

    The actual scrolling is taking place in another form, but with the code in the same form, I still get the horrible flickering.

  7. #7
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: [RESOLVED] Scroll in VB (one more question!)

    I don't thing you can prevent this flickring. textout() api is another opion. but i have not done any scrolling with that.

  8. #8
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: [RESOLVED] Scroll in VB (one more question!)

    TextOut() method,no flickring.

    *timer interval 100

    Code:
    Option Explicit
    Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
    Dim i As Long, p As Long
    Dim str As String
    
    Private Sub Timer1_Timer()
    str = "hai"
    Cls
    TextOut Me.hdc, i, 0, ByVal str, Len(str)
    'Debug.Print i, Me.Width / Screen.TwipsPerPixelX
    If i > Me.Width / Screen.TwipsPerPixelX Then
       i = 0
    Else
       i = i + 10
    End If
    End Sub
    Edited : The code has little bit modified from the first post.
    Attached Files Attached Files
    Last edited by Fazi; Jan 11th, 2008 at 11:18 PM.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2007
    Location
    Canada
    Posts
    297

    Re: [RESOLVED] Scroll in VB (one more question!)

    How do I actually apply this? Where... does it .. display?

  10. #10
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: [RESOLVED] Scroll in VB (one more question!)


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