Flash Picturebox Background?

Len
09-28-2001, 03:13 PM
Hi,

I need to flash the color of a Picturebox background. Can somebody tell me how. Here's an example of what DOESN'T work.

Thanks in advance,
Len

Len
09-28-2001, 03:17 PM
Forgot the attachment as usual: This doesn't work for some reason:

Sub FlashBack(A)
Dim X As Byte
Dim Y As Long
Form2.Picture1(A).BackColor = QBColor(14)
For X = 1 To 30
Y = Timer
Do
Loop Until Timer >= Y + 0.5
Form2.Picture1(A).BackColor = QBColor(0)
Y = Timer
Do
Loop Until Timer >= Y + 0.5
Form2.Picture1(A).BackColor = QBColor(14)
Y = Timer
Do
Loop Until Timer >= Y + 0.5
Next X
End Sub

Derek Stone
09-28-2001, 03:35 PM
You might try this:

<pre>
Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

Sub FlashBack(A)
Form2.Picture1(A).BackColor = QBColor(14)
Sleep 500
Form2.Picture1(A).BackColor = QBColor(0)
Sleep 500
Form2.Picture1(A).BackColor = QBColor(14)
End Sub

</pre>

Good Luck
-cl

Len
09-28-2001, 03:48 PM
Thats ALOT better!

Thank you.

BillSoo
09-28-2001, 04:34 PM
I haven't tested it, but I suspect the problem with your original code was a lack of doevents or refresh methods.


"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder

txk
09-28-2001, 06:25 PM
I am just curious. why do you need that argument of "A"?

orufet
09-28-2001, 06:39 PM
I believe it's for the index property, so that it happens to each control in the array

"I do not agree with a word you say, but I will defend to the death your right to say it" - Voltaire

txk
09-28-2001, 06:55 PM
Oh!! that makes sense. I get you. thanks.

TK

Derek Stone
09-28-2001, 07:13 PM
His code also didn't work because he was trying to add 0.5 (non-integer) to a long value, which will just return a result which is equivalent to the original long value.
Long's cannot hold decimal places.

Good Luck
-cl

Len
09-29-2001, 05:33 AM
What kind of variable should I use (if not "long") that I can load a timer value into, and increase by (some decimal place)? ie. .5 sec

Squirm
09-29-2001, 05:37 AM
0.5 secs on a timer is 500 - the timer works in milliseconds, so 1000 = 1 sec, as I recall.........

Derek Stone
09-29-2001, 09:06 AM
I responded to you by PM at your request.

Good Luck
-cl

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum