home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / effect1a / frminfin.frm (.txt) next >
Encoding:
Visual Basic Form  |  1999-09-04  |  5.4 KB  |  150 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Effects using the line property of the picture box control"
  5.    ClientHeight    =   3180
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   5940
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   3180
  13.    ScaleWidth      =   5940
  14.    StartUpPosition =   3  'Windows Default
  15.    Begin VB.CommandButton Command3 
  16.       Caption         =   "Stop Timer"
  17.       Height          =   495
  18.       Left            =   4920
  19.       TabIndex        =   7
  20.       Top             =   1920
  21.       Width           =   735
  22.    End
  23.    Begin VB.CommandButton Command2 
  24.       Caption         =   "Move lines"
  25.       Height          =   495
  26.       Left            =   3840
  27.       TabIndex        =   6
  28.       Top             =   1920
  29.       Width           =   735
  30.    End
  31.    Begin VB.Timer Timer1 
  32.       Left            =   0
  33.       Top             =   2760
  34.    End
  35.    Begin VB.CommandButton Command1 
  36.       Caption         =   "Clear"
  37.       Height          =   375
  38.       Left            =   4080
  39.       TabIndex        =   5
  40.       Top             =   2640
  41.       Width           =   1215
  42.    End
  43.    Begin VB.CommandButton cmdrgradient 
  44.       Caption         =   "radial gradient "
  45.       Height          =   735
  46.       Left            =   4920
  47.       TabIndex        =   4
  48.       Top             =   960
  49.       Width           =   735
  50.    End
  51.    Begin VB.CommandButton cmdgradient 
  52.       Caption         =   "black to blue gradient"
  53.       Height          =   735
  54.       Left            =   4920
  55.       TabIndex        =   3
  56.       Top             =   120
  57.       Width           =   735
  58.    End
  59.    Begin VB.CommandButton cmdcurve 
  60.       Caption         =   "draw a curve"
  61.       Height          =   735
  62.       Left            =   3840
  63.       TabIndex        =   2
  64.       Top             =   960
  65.       Width           =   735
  66.    End
  67.    Begin VB.CommandButton cmd 
  68.       Caption         =   "draw infinity"
  69.       Height          =   735
  70.       Left            =   3840
  71.       TabIndex        =   1
  72.       Top             =   120
  73.       Width           =   735
  74.    End
  75.    Begin VB.PictureBox Picture1 
  76.       AutoRedraw      =   -1  'True
  77.       BackColor       =   &H80000009&
  78.       DrawWidth       =   3
  79.       Height          =   2895
  80.       Left            =   240
  81.       ScaleHeight     =   400
  82.       ScaleMode       =   0  'User
  83.       ScaleWidth      =   386.026
  84.       TabIndex        =   0
  85.       Top             =   120
  86.       Width           =   3375
  87.    End
  88. Attribute VB_Name = "Form1"
  89. Attribute VB_GlobalNameSpace = False
  90. Attribute VB_Creatable = False
  91. Attribute VB_PredeclaredId = True
  92. Attribute VB_Exposed = False
  93. Private Sub cmd_click()
  94. Picture1.DrawWidth = 1                           'algorithms draw a line from the boder to the center of the picture box
  95.                                                  'going all the way around the border to create an infinity effect
  96. For c = 1 To Picture1.ScaleHeight Step 15
  97.  Picture1.Line (0, a)-(Picture1.ScaleHeight / 2, Picture1.ScaleWidth / 2)
  98. Next c
  99. For c = 1 To Picture1.ScaleHeight Step 15
  100.  Picture1.Line (a, 0)-(Picture1.ScaleHeight / 2, Picture1.ScaleWidth / 2)
  101. Next c
  102. For c = 1 To Picture1.ScaleHeight Step 15
  103.  Picture1.Line (Picture1.ScaleWidth, Picture1.ScaleHeight - c)-(0, c)
  104. Next c
  105. For c = 1 To Picture1.ScaleHeight Step 15
  106.  Picture1.Line (Picture1.ScaleWidth - c, Picture1.ScaleHeight)-(c, 0)
  107. Next c
  108. End Sub
  109. Private Sub Cmdcurve_Click()
  110. Picture1.DrawWidth = 1
  111. For i = 1 To 400 Step 10
  112. Picture1.Line (i, 0)-(Picture1.ScaleWidth, i)
  113. Next i
  114. Picture1.DrawWidth = 1
  115. For i = 1 To 400 Step 10
  116. Picture1.Line (i, Picture1.ScaleHeight)-(0, i)
  117. Next i
  118. End Sub
  119. Private Sub cmdgradient_Click()
  120. For i = 1 To 400
  121. Picture1.Line (i, Picture1.ScaleHeight)-(i, 0), RGB(0, 0, i)         'this makes a wash from black to blue
  122. Next i
  123. End Sub                                                              'it draws a line and every line it draws the value of the rgb gets +1
  124.                                                                      'creating a gradient effect
  125.                                                                      'same for the radial gradient, just drawing circles
  126. Private Sub Cmdrgradient_Click()
  127. Picture1.DrawWidth = 3
  128. For i = 1 To 400
  129. Picture1.Circle (200, 200), i, RGB(0, 0, i)
  130. Next i
  131. End Sub
  132. Private Sub Command1_Click()
  133. Picture1.BackColor = &H80000009          'this button clears the image and sets the scale width and scale height
  134. Picture1.ScaleHeight = 400               'of the picturebox back to 400
  135. Picture1.ScaleWidth = 400
  136. End Sub
  137. Private Sub Command2_Click()
  138. Timer1.Interval = 200                    'starts the timer
  139. End Sub
  140. Private Sub Command3_Click()
  141. Timer1.Interval = 0                      'stops the timer
  142. End Sub
  143. Private Sub Timer1_Timer()
  144. Picture1.BackColor = &H80000009                         'this functions clears then subtracts 10 from the scale height and scale width of the picture box
  145. Picture1.ScaleWidth = Picture1.ScaleWidth - 10          'then redraws the curved lines to make it look like your getting closer to the lines
  146. Picture1.ScaleHeight = Picture1.ScaleHeight - 10
  147. Call Cmdcurve_Click
  148. If Picture1.ScaleHeight < 40 Then Timer1.Interval = 0   'stops the timer when picture1.scaleheight < 40 because if it didn't there would be an overflow error
  149. End Sub
  150.