home *** CD-ROM | disk | FTP | other *** search
/ The Mother of All Windows Books / CD-MOM.iso / cd_mom / newsletr / vbz / vbz1-3 / clocks.bas < prev    next >
BASIC Source File  |  1992-04-24  |  889b  |  43 lines

  1. DefInt A-Z
  2.  
  3. Global Const AppName$ = "sample"
  4.  
  5. Sub CleanUp ()
  6.     Unload frmSave
  7. End Sub
  8.  
  9. Sub InitSave ()
  10.     frmSave.timSave.Interval = 1000
  11.     frmSave.timSave.Enabled = True
  12.     frmSave.Show
  13.  
  14.  
  15.     frmSave.ForeColor = &HFFFFF
  16.     frmSave.FontSize = 30
  17. End Sub
  18.  
  19. Sub TimerProc ()
  20. Static x, y, OldTime$
  21.  
  22.  
  23. 'Erase time you printed last by printing it again in the background color
  24. frmSave.CurrentX = x
  25. frmSave.CurrentY = y
  26. frmSave.ForeColor = frmSave.BackColor
  27. frmSave.Print OldTime
  28.  
  29. 'Move current spot to a random spot that won't clip the time
  30. theight = frmSave.TextHeight(Time)
  31. x = Int((frmSave.ScaleWidth - frmSave.TextWidth(Time)) * Rnd)
  32. y = Int((frmSave.ScaleHeight - frmSave.TextHeight(Time)) * Rnd)
  33. frmSave.CurrentX = x
  34. frmSave.CurrentY = y
  35.  
  36. 'print the time in white
  37. frmSave.ForeColor = &HFFFFF
  38. OldTime$ = Time
  39. frmSave.Print OldTime$
  40.  
  41. End Sub
  42.  
  43.