Blinking Text

  • Thread starter Thread starter Brad Markisohn
  • Start date Start date
B

Brad Markisohn

Is there a way to make text blink in a text box or on a label?

TIA

Brad
 
Brad,

You mean something as this?

\\\
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
_
Handles MyBase.Load
Dim aTimer As New System.Timers.Timer
AddHandler aTimer.Elapsed, AddressOf OnTimedEvent
Me.Label1.ForeColor = Drawing.Color.White
aTimer.Interval = 500
Me.Label1.Text = "I am up again"
Me.Label1.BackColor = Drawing.Color.Red
aTimer.Enabled = True
End Sub
Private Sub OnTimedEvent(ByVal source As Object, ByVal e As _
System.Timers.ElapsedEventArgs)
If Me.Label1.BackColor.ToArgb = Drawing.Color.Blue.ToArgb Then
Me.Label1.Text = "I am up again"
Me.Label1.BackColor = Drawing.Color.Red
Else
Me.Label1.Text = "I am to bed"
Me.Label1.BackColor = Drawing.Color.Blue
End If
End Sub
///
I hope this helps a little bit?

Cor
 
Jeff,

Nice link, I have basicly the same ideas as in that article.

Cor
 
* "Brad Markisohn said:
Is there a way to make text blink in a text box or on a label?

Add a 'System.Windows.Forms.Timer' to your form, set its interval to
500, for example, add a handler to the timer's 'Tick' event and type
this code:

\\\
Me.Label1.Visible = Not Me.Label1.Visible
///
 
Herfried K. Wagner said:
Add a 'System.Windows.Forms.Timer' to your form, set its interval to
500, for example, add a handler to the timer's 'Tick' event and type
this code:

\\\
Me.Label1.Visible = Not Me.Label1.Visible
///

Sweet.
 

BTW, I went and fooled around with that. If you use that with a textbox the
whole box blinks. I came up with this:

Public Class Form1

Private fore, back As Color

Private switch As Boolean



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

fore = txtDisplay.ForeColor

back = txtDisplay.BackColor

End Sub



Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick

txtDisplay.ForeColor = IIf(switch, fore, back)

switch = Not switch

End Sub

End Class
 
Nice link, I have basicly the same ideas as in that article.

Yes, I agree with MOST of them. I think they went a little overboard in a
couple of places, but overall it's right on the mark.

And some of it is just plain funny.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top