by Arman Samavatian (3 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 23rd July 2003
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
Draw a flower with pset method
API Declarations
Microsoft Windows Common Controls-2 6.0
''''''''''''''''''''''''''''
Private Sub Form_Load()
Text1.Text = Timer1.Interval
Call Picture1.Cls
With UpDown1
.Min = 0
.Max = 100000000
.Wrap = True
.Increment = 100
End With
End Sub
''''''''''''''''''''''''''''
Private Sub Drawshape()
Dim x As Single, y As Single
Dim total As Single, r As Single
Dim a As Single, theta As Single
Call Randomize
Picture1.Scale (4, -4)-(-4, 4)
total = 8 * Atn(1)
Picture1.ForeColor = QBColor(Rnd() * 15)
a = 3 * Rnd()
For theta = 0 To total Step 0.01
r = a * Sin(10 * theta)
x = r * Cos(theta)
y = r * Sin(theta)
Picture1.PSet (x, y)
r = a * Sin(10 * theta)
x = r * Cos(theta)
y = r * Tan(45 * theta)
Picture1.PSet (x, y)
Next theta
End Sub
''''''''''''''''''''''''''''
Private Sub cmd_clear_Click()
Call Picture1.Cls
End Sub
''''''''''''''''''''''''''''
Private Sub Text1_Change()
On Error GoTo Ex
UpDown1.Value = Text1.Text
If Text1.Text = "" Then
Timer1.Enabled = False
Else
Timer1.Enabled = True
End If
Ex:
Exit Sub
End Sub
''''''''''''''''''''''''''''
Private Sub Timer1_Timer()
Call Drawshape
End Sub
''''''''''''''''''''''''''''
Private Sub UpDown1_Change()
Timer1.Interval = UpDown1.Value
Text1.Text = UpDown1.Value
End Sub