home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD56645102000.psc / Main.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-05-10  |  7.6 KB  |  186 lines

  1. VERSION 5.00
  2. Begin VB.Form MainFrm 
  3.    BackColor       =   &H00000000&
  4.    BorderStyle     =   0  'None
  5.    Caption         =   "CSS"
  6.    ClientHeight    =   3195
  7.    ClientLeft      =   0
  8.    ClientTop       =   0
  9.    ClientWidth     =   4680
  10.    Icon            =   "Main.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   3195
  13.    ScaleWidth      =   4680
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   3  'Windows Default
  16.    WindowState     =   2  'Maximized
  17.    Begin VB.Timer PrepVal 
  18.       Interval        =   1
  19.       Left            =   720
  20.       Top             =   0
  21.    End
  22.    Begin VB.Timer CRT 
  23.       Enabled         =   0   'False
  24.       Interval        =   1
  25.       Left            =   360
  26.       Top             =   0
  27.    End
  28.    Begin VB.Timer CACI 
  29.       Left            =   0
  30.       Top             =   0
  31.    End
  32. Attribute VB_Name = "MainFrm"
  33. Attribute VB_GlobalNameSpace = False
  34. Attribute VB_Creatable = False
  35. Attribute VB_PredeclaredId = True
  36. Attribute VB_Exposed = False
  37. '+-----------------------------------------------+
  38. '|         ***Source Code Information***         |
  39. '|                                               |
  40. '|Author:    InfraRed                            |
  41. '|                                               |
  42. '|E-Mail:    InfraRed@flashmail.com              |
  43. '|                                               |
  44. '|ICQ UIN:   17948286                            |
  45. '|                                               |
  46. '|Comments:  I hope you enjoy my source code.  I |
  47. '|worked very hard on this, and if you use       |
  48. '|anything from here, I would like to get credit |
  49. '|for it.  If it makes you feel any better, you  |
  50. '|can e-mail/ICQ me and ask permission to use my |
  51. '|source code...  BUT you don't have to!  If you |
  52. '|have any complaints, compliments, comments,    |
  53. '|threats, fan mail, junk mail, hate mail, or    |
  54. '|anything else you can think of, go ahead and   |
  55. '|send.                                          |
  56. '|                                               |
  57. '|              ***Enjoy my code!***             |
  58. '+-----------------------------------------------+
  59. Dim MCA As Integer, CEMin As Integer, CEMax As Integer, CAA As Integer, CAR As Boolean, NDDI As Integer, NRS As Integer, CGR(9) As Boolean, MPX As Single, MPY As Single, DirX As Integer, DirY As Integer, CCPX As Single, CCPY As Single
  60. 'Sorry for all of the abreviations, this will help:
  61.   'MCA = Max Circle Amount
  62.   'CEMin = Circle Expansion Minimum
  63.   'CEMax = Circle Expansion Maximum
  64.   'CAA = Circle Amount Activated
  65.   'CAR = Circle Activation Reverse
  66.   'NDDI = Next Dot Degree Interval
  67.   'NRS = Next Rotation Speed
  68.   'CGR = Circle Go Reverse
  69.   'MPX = Mouse Position X
  70.   'MPY = Mouse Position Y
  71.   'DirX = Direction X (0 = left, 1 = right)
  72.   'DirY = Direction Y (0 = down, 1 = up)
  73.   'CCPX = Circle Center Position X
  74.   'CCPY = Circle Center Position Y
  75. Private Sub CACI_Timer() 'CACI = Circle Amount Change Interval
  76. If CAR = False Then 'If the max amount of circles are here, don't add any more!
  77. CAA = CAA + 1 'Add to circle amount
  78. PrepareCM 'Get the new circle ready and loaded
  79.   If CAA = MCA Then CAR = True 'If the max circles has been reached, don't allow any more to form
  80. End If
  81. End Sub
  82. Private Sub CRT_Timer() 'Circle Rotation Timer
  83. Dim i As Integer
  84.   If CCPX + DA + CEMax > Screen.Width And DirX = 1 Then 'Don't let the circle go off the right side of the screen
  85.   DirX = 0 'Change the X direction (to left)
  86.   ElseIf CCPX - (DA + CEMax) < 0 And DirX = 0 Then 'Don't let the circle go off the left side of the screen
  87.   DirX = 1 'Change the X direction (to right)
  88.   End If
  89.   If CCPY + DA + CEMax > Screen.Height And DirY = 1 Then 'Don't let the circle go off the bottom of the screen
  90.   DirY = 0 'Change the X direction (to up)
  91.   ElseIf CCPY - (DA + CEMax) < 0 And DirY = 0 Then 'Don't let the circle go off the top of the screen
  92.   DirY = 1 'Change the X direction (to down)
  93.   End If
  94.     'Add to center offset (move)
  95.     '--------------------------------
  96.     If DirX = 1 Then CCPX = CCPX + DA
  97.     If DirX = 0 Then CCPX = CCPX - DA
  98.     If DirY = 1 Then CCPY = CCPY + DA
  99.     If DirY = 0 Then CCPY = CCPY - DA
  100.     '--------------------------------
  101. For i = 0 To CAA - 1 'Loop through circles
  102.   If CM(i).Radius + CA > TP(i) And CGR(i) = False Then 'When the circle reaches the target radius, make it shrink back to 0
  103.   CM(i).Radius = TP(i)
  104.   CGR(i) = True
  105.   ElseIf CM(i).Radius - CA < 1 And CGR(i) = True Then 'When circle reaches 0 radius, select a new target radius and start expanding
  106.   CM(i).Radius = 1
  107.   CGR(i) = False
  108.   TP(i) = RndTP
  109.   ElseIf CGR(i) = False Then
  110.   CM(i).Radius = CM(i).Radius + CA 'Expand circle
  111.   ElseIf CGR(i) = True Then
  112.   CM(i).Radius = CM(i).Radius - CA 'Contract circle
  113.   End If
  114. CM(i).Set_Center_Position CCPX, CCPY 'Set the new center position
  115. CM(i).Draw_Circle i 'Draw the current circle
  116. Next i 'Loop back
  117. End Sub
  118. Private Sub Form_Click()
  119. Unload Me 'Unload form
  120. End Sub
  121. Private Sub Form_Load()
  122. SetUpSystem 'Hide mouse
  123. LoadRegValues 'Loads the options (saved in registry)
  124. End Sub
  125. Public Sub LoadRegValues() 'Loads all of the options in the registry, self explanitory
  126. CACI.Interval = GetSetting("Cyclone", "OP", "0", "30") & "000"
  127. MCA = GetSetting("Cyclone", "OP", "1", "5")
  128. CEMin = GetSetting("Cyclone", "OP", "2", "500")
  129. CEMax = GetSetting("Cyclone", "OP", "3", "3000")
  130. NDDI = GetSetting("Cyclone", "OP", "4", "6")
  131. NRS = GetSetting("Cyclone", "OP", "5", "3")
  132. End Sub
  133. Public Sub PrepareValues()
  134. Randomize Timer 'Generate a new random number set
  135. CAA = 1 'Startup with 1 circle loaded
  136. DirX = Int((2 - 1 + 1) * Rnd + 1) - 1 'Select random direction (left or right)
  137. DirY = Int((2 - 1 + 1) * Rnd + 1) - 1 'Select random direction (up or down)
  138. CCPX = Int((Screen.Width - CEMax + 1) * Rnd + CEMax) 'Select a random place (X) for the circle to start at
  139. CCPY = Int((Screen.Height - CEMax + 1) * Rnd + CEMax) 'Select a random place (Y) for the circle to start at
  140. PrepareCM 'Prepare the first circle
  141. End Sub
  142. Public Sub PrepareCM() 'Prepares and creates circles
  143. CM(CAA - 1).Dot_Color = SelRndCol 'Select a random color for the circle
  144. CM(CAA - 1).Dot_Degree_Interval = NDDI 'Select the circle's DDI (Dot Degree Interval)
  145. CM(CAA - 1).Radius = 1 'Set its radius to 1
  146. CM(CAA - 1).Rotation_Speed = NRS 'Set it to the default rotation speed
  147. CM(CAA - 1).Set_Center_Position CCPX, CCPY 'Put it in the same position as the other circles
  148. TP(CAA - 1) = RndTP 'Select the circle's target radius
  149. CGR(CAA - 1) = False 'The circle is NOT contracting
  150. End Sub
  151. Public Sub KillCM() 'Kill the circle
  152. DC(CAA) = True
  153. End Sub
  154. Function SelRndCol() As Long 'Select a random color, self explanitory
  155. Dim Col(2) As Integer, i As Integer
  156. Randomize Timer
  157. Start:
  158. For i = 0 To 2
  159. Col(i) = Int((255 - 1 + 1) * Rnd + 1)
  160. Next i
  161.   If Not Col(0) > 150 Or Not Col(1) > 150 Or Not Col(2) > 150 Then GoTo Start
  162. SelRndCol = RGB(Col(0), Col(1), Col(2))
  163. End Function
  164. Function RndTP() As Integer 'Select a random target radius, self explanitory
  165. Randomize Timer
  166. RndTP = Int((CEMax - CEMin + 1) * Rnd + CEMin)
  167. End Function
  168. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 'If the mouse moves, kill the screensaver
  169. If Not MPX = Mouse.X Or Not MPY = Mouse.Y Then
  170. Unload Me
  171. End If
  172. End Sub
  173. Private Sub Form_Unload(Cancel As Integer) 'Show the cursor when unloaded (when running this in a compiler)
  174. ShowCursor True
  175. End Sub
  176. Private Sub PrepVal_Timer() 'Prepare values after the form has maximized
  177. PrepareValues
  178. CRT.Enabled = True
  179. PrepVal.Enabled = False
  180. End Sub
  181. Public Sub SetUpSystem() 'Get original mouse positions
  182. MPX = Mouse.X
  183. MPY = Mouse.Y
  184. Ontop Me 'Set ontop
  185. End Sub
  186.