Results 1 to 10 of 10

Thread: Text Flashing

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2002
    Posts
    28

    Text Flashing

    Hello,

    I want to do a sort of text effect in VB6 I have seen it done before where the text will flash from white to red, white to red, white to red etc...

    I am not sure of the coding though?

    Thanks

  2. #2
    Hyperactive Member ZeroCool's Avatar
    Join Date
    Feb 2002
    Location
    In front of my computer
    Posts
    423
    I A TextBox?

  3. #3
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    For a textbox (you need a timer):

    VB Code:
    1. Private Sub Timer1_Timer()
    2.   If Text1.ForeColor = vbRed Then
    3.     Text1.ForeColor = vbBlack
    4.   Else
    5.     Text1.ForeColor = vbRed
    6.   End If
    7. End Sub
    8.  
    9. Private Sub Form_Load()
    10.   Timer1.Interval = 10
    11. End Sub

  4. #4
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    For a label, just replace Text1 with Label1, or whatever the name of the label is.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2002
    Posts
    28
    that just made the label text 1 color? I want the word to be flashing white red white red white red on and on....

  6. #6
    Hyperactive Member ZeroCool's Avatar
    Join Date
    Feb 2002
    Location
    In front of my computer
    Posts
    423
    The Hobo Did It Right The text was just changing to fast for you to notice:

    VB Code:
    1. Private Sub Timer1_Timer()
    2.   If Text1.ForeColor = vbRed Then
    3.     Text1.ForeColor = vbWhite
    4.   Else
    5.     Text1.ForeColor = vbRed
    6.   End If
    7. End Sub
    8.  
    9. Private Sub Form_Load()
    10.   Timer1.Interval = 100
    11. End Sub

    Just Keep Changing The Timer1.Interval Property untill you have have it the way you like

  7. #7
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by ZeroCool
    The Hobo Did It Right The text was just changing to fast for you to notice
    I Guess I have a slow processor. Or eagle eyes.

  8. #8
    Lively Member
    Join Date
    Mar 2001
    Location
    Graduate Office (aka "Pit of Despair")
    Posts
    88
    Hmm, I always thought the timer was measured in milliseconds. Wouldn't it be independent of the processor?

    If not, I'm going to need to change my code.
    - Kronix


    "I have not failed. I have merely found 10,000 ways that won't work." - Thomas Edison

  9. #9
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    if you have a slow processor and you have other tasks running from your app or other, then it would maybe sometimes skip a few times.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  10. #10
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by BuggyProgrammer
    if you have a slow processor and you have other tasks running from your app or other, then it would maybe sometimes skip a few times.
    Actually, I was just joking, but yeah...see above.
    My evil laugh has a squeak in it.

    kristopherwilson.com

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