CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Form's Caption

  1. #1
    Join Date
    Feb 2003
    Posts
    38

    Question Form's Caption

    hello,

    i want to make form's caption scrolling. means text in caption start moving in its bar. just like we us MARQUEE tag in HTML to scroll the text. how is it possible ?

    thanks

  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    A simple way...

    Add a timer to a form.
    Copypaste this code.
    Code:
    Option Explicit
    Private Const FormCaption = "Hello, Word!"
    Private Sub Form_Load()
       Me.Caption = FormCaption
       Timer1.Interval = 250
       Timer1.Enabled = True
    End Sub
    
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
       Timer1.Enabled = False
    End Sub
    
    Private Sub Timer1_Timer()
    Static Counter As Integer
    Counter = Counter + 1
    If Counter > Len(FormCaption) Then
       Counter = 1
    End If
    Me.Caption = Space(Len(FormCaption) - Counter) & Left(FormCaption, Counter)
    End Sub
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Sep 2003
    Posts
    15
    wow thats cool = D

  4. #4
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Nice to know you enjoied

    Have a nice day,

    Cesare Imperiali
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  5. #5
    Join Date
    Jan 2001
    Posts
    486
    Nice to see someone tweak the standard "Hello, world!"

    Just kiddin', neat code.
    If kids were left to their own devices, would they ever come up with a thing like war?......The Wheel / Todd Rundgren

    Do canibals not eat clowns because they taste funny?

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

Featured