|
-
Jan 26th, 2004, 09:17 AM
#1
Thread Starter
Frenzied Member
making backcolor switch back and forth[RESOLVED]
using a timer, how do I code the background color for my group boxes to flash from one color to the next until a condition is met? (mainly, I just need help getting the colors alternating, I have the code to check the condition)
Thanks!!
Last edited by Andy; Feb 11th, 2004 at 09:44 PM.
-
Jan 26th, 2004, 09:42 AM
#2
Thread Starter
Frenzied Member
I figured this much out. It works exactly like I want.
Can anyone think of a better, more efficient way of coding this?
Code:
Private Sub tmrGrpCurrentOpen_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrGrpCurrentOpen.Tick
If grpCurrentOpen.BackColor.Equals(AliceBlue) Then
grpCurrentOpen.BackColor = Red
Else
grpCurrentOpen.BackColor = AliceBlue
End If
End Sub
-
Jan 27th, 2004, 05:06 AM
#3
I don't think this is better, but it's different. It might be useful depending on what else is going on in your application.
On balance, I think you should stick with what you've got.
VB Code:
Private tmr As New Timer()
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler Application.Idle, AddressOf Flash
tmr.Interval = 1000
tmr.Start()
End Sub
Private Sub Flash(ByVal sender As Object, ByVal e As System.EventArgs)
If Now.Second Mod 2 = 0 Then
grpCurrentOpen.BackColor = Color.Red
Else
grpCurrentOpen.BackColor = Color.AliceBlue
End If
End Sub
This world is not my home. I'm just passing through.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|