yourmuminabagel Posted May 18, 2009 Report Posted May 18, 2009 How to make a label flash different colours in VB 2008.Coded by K ii 3 R Zz. Insert 2 Timers and 1 label. change timer1's interval to 50 and set it as enabled and timer2's interval to 100 and set it as enabledMake the labels Forecolor to Black <----- Very Important! Now Double Click Timer1 And Type In This Code: If Label1.ForeColor = Color.Black Then Label1.ForeColor = Color.Blue ElseIf Label1.ForeColor = Color.Blue Then Label1.ForeColor = Color.Red ElseIf Label1.ForeColor = Color.Red Then Label1.ForeColor = Color.Green ElseIf Label1.ForeColor = Color.Green Then Label1.ForeColor = Color.Yellow ElseIf Label1.ForeColor = Color.Yellow Then Label1.ForeColor = Color.Black End If Now Double Click Timer2 And Type In This Code: if Label1.Visible = True Then Label1.Visible = False ElseIf Label1.Visible = False Then Label1.Visible = True End If Hope You Enjoy!
yungbol Posted May 18, 2009 Report Posted May 18, 2009 Here goes how to do it in C#: if (label1.ForeColor == Color.Black) label1.ForeColor = Color.Blue;
SotG Caboose Posted May 18, 2009 Report Posted May 18, 2009 (edited) Or you can do this: (VB6 only)Label1.ForeColor = RGB(Int(Rnd() * 256), Int(Rnd() * 256), Int(Rnd() * 256)) Edited May 18, 2009 by Boosie♥
Dark Slipstream Posted May 19, 2009 Report Posted May 19, 2009 (edited) Or you can do this: (VB6 only)Label1.ForeColor = RGB(Int(Rnd() * 256), Int(Rnd() * 256), Int(Rnd() * 256)) VB.NET (Very Similar)Randomize() Label1.ForeColor = Color.FromArgb(Int(Rnd() * 256), Int(Rnd() * 256), Int(Rnd() * 256)) C# (Google told me about the Random class)Random Rnd = new Random(); Label1.ForeColor = Color.FromArgb((int)Rnd.Next(256), (int)Rnd.Next(256), (int)Rnd.Next(256)); Edited May 19, 2009 by Dark Slipstream
iBotPeaches Posted May 21, 2009 Report Posted May 21, 2009 It will change once, maybe put a timer on it at 1000MS and then let it do it say 100 times, or something. Or until you close the app
yourmuminabagel Posted May 22, 2009 Author Report Posted May 22, 2009 You Need Two Timers.Make them both enabled and change timer1's interval to 50.And change the fore colour of the label to black
Joe Walls Posted May 23, 2009 Report Posted May 23, 2009 (edited) Mine just blinks fast, no colors except black. Edit:Fixed. How can I put this in Adobe Dreamweaver? Edited May 23, 2009 by Joe Walls
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now