home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 6 Unleashed…sional Reference Edition) / Visual_Basic_6_Unleashed_Professional_Reference_Edition_Sams_1999.iso / Source / CHAP05 / 309X0520.TXT < prev    next >
Encoding:
Text File  |  1998-05-27  |  1.4 KB  |  43 lines

  1.  
  2. Public Sub Flash(NumTimes As Integer)
  3.  
  4.      Dim booButtonLighted As Boolean
  5.      Dim intFlashLoop As Integer
  6.      Dim sinOldTimer As Single
  7.  
  8.      ' If an invalid argument was passed to the
  9.      ' method, exit now.
  10.      If NumTimes <= 0 Then Exit Sub
  11.  
  12.      booButtonLighted = mbooButtonLighted
  13.  
  14.      For intFlashLoop = 1 To (NumTimes * 2)
  15.           ' Switch the button's status.
  16.           booButtonLighted = Not booButtonLighted
  17.           If booButtonLighted = True Then
  18.                ' Change the control's background color or
  19.                ' image to reflect a "selected" state.
  20.                If mmodButtonMode = [Text Only Mode] Then
  21.                     UserControl.BackColor = molcSelColor
  22.                Else
  23.                     Set UserControl.Picture = mpicSelPicture
  24.                End If
  25.           Else
  26.                ' Change the control's background color or
  27.                ' image to reflect an "unselected" state.
  28.                If mmodButtonMode = [Text Only Mode] Then
  29.                     UserControl.BackColor = molcBackColor
  30.                Else
  31.                     Set UserControl.Picture = mpicPicture
  32.                End If
  33.           End If
  34.           ' Wait a short amount of time before changing the
  35.           ' control's status again.
  36.           sinOldTimer = Timer
  37.           Do
  38.                DoEvents
  39.           Loop Until (Timer >= sinOldTimer + 0.5)
  40.      Next intFlashLoop
  41.  
  42. End Sub
  43.