VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "花瓣图案"
   ClientHeight    =   5760
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6555
   LinkTopic       =   "Form1"
   ScaleHeight     =   5760
   ScaleWidth      =   6555
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame2 
      Caption         =   "参数区"
      Height          =   1410
      Left            =   4485
      TabIndex        =   10
      Top             =   4170
      Width           =   1980
      Begin VB.HScrollBar HScroll4 
         Height          =   255
         Left            =   150
         TabIndex        =   14
         Top             =   465
         Width           =   1770
      End
      Begin VB.HScrollBar HScroll5 
         Height          =   240
         Left            =   150
         TabIndex        =   13
         Top             =   1125
         Width           =   1740
      End
      Begin VB.TextBox Text1 
         Height          =   255
         Left            =   1500
         TabIndex        =   12
         Text            =   "Text1"
         Top             =   180
         Width           =   405
      End
      Begin VB.TextBox Text2 
         Height          =   270
         Left            =   1455
         TabIndex        =   11
         Text            =   "Text2"
         Top             =   825
         Width           =   420
      End
      Begin VB.Label Label7 
         Caption         =   "花瓣样式"
         Height          =   255
         Left            =   615
         TabIndex        =   16
         Top             =   825
         Width           =   750
      End
      Begin VB.Label Label6 
         Caption         =   "花瓣数"
         Height          =   195
         Left            =   615
         TabIndex        =   15
         Top             =   210
         Width           =   675
      End
   End
   Begin VB.CommandButton Command1 
      Caption         =   "绘制"
      Height          =   420
      Left            =   5280
      TabIndex        =   8
      Top             =   3615
      Width           =   990
   End
   Begin VB.Frame Frame1 
      Caption         =   "调色区"
      Height          =   1395
      Left            =   120
      TabIndex        =   0
      Top             =   4170
      Width           =   4320
      Begin VB.HScrollBar HScroll3 
         Height          =   300
         Left            =   735
         TabIndex        =   3
         Top             =   990
         Width           =   2370
      End
      Begin VB.HScrollBar HScroll2 
         Height          =   300
         Left            =   735
         TabIndex        =   2
         Top             =   570
         Width           =   2370
      End
      Begin VB.HScrollBar HScroll1 
         Height          =   300
         Left            =   720
         TabIndex        =   1
         Top             =   150
         Width           =   2370
      End
      Begin VB.Label Label5 
         BorderStyle     =   1  'Fixed Single
         Height          =   1065
         Left            =   3345
         TabIndex        =   7
         Top             =   210
         Width           =   855
      End
      Begin VB.Label Label4 
         Caption         =   "蓝色"
         Height          =   210
         Left            =   195
         TabIndex        =   6
         Top             =   1005
         Width           =   360
      End
      Begin VB.Label Label3 
         Caption         =   "绿色"
         Height          =   195
         Left            =   195
         TabIndex        =   5
         Top             =   645
         Width           =   420
      End
      Begin VB.Label Label2 
         Caption         =   "红色"
         Height          =   195
         Left            =   180
         TabIndex        =   4
         Top             =   195
         Width           =   420
      End
   End
   Begin VB.Label Label1 
      Caption         =   "花瓣形曲线"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   2025
      Left            =   5715
      TabIndex        =   9
      Top             =   705
      Width           =   435
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
   Dim Q As Single, R As Single, N As Single, M As Single
  Dim X1 As Single, Y1 As Single, X2 As Single, Y2 As Single
   Const PI = 3.1415926
   Cls                                  '清屏
   N = Val(Text1.Text)                  'Val函数将文本框内的字符型数据转化为数值
   M = Val(Text2.Text)
   DrawWidth = 1                        '设置线宽为1个点
   Me.Scale (-400, 400)-(900, -900)     '重新定义坐标系,以便于绘图
   '下列语句用于绘制图案
   For Q = 0 To 2 * PI Step PI / 360
      R = 160 * (1 + Sin(N * Q))
      X1 = R * Cos(Q)
      X2 = R * Cos(Q + PI / M)
      Y1 = R * Sin(Q)
      Y2 = R * Sin(Q + PI / M)
      Line (X1, Y1)-(X2, Y2), RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
   Next Q
End Sub


Private Sub Form_Load()
    '初始化滚动条
    HScroll1.Max = 255
    HScroll1.Min = 0
    HScroll1.LargeChange = 5
    HScroll1.SmallChange = 1
    HScroll2.Max = 255
    HScroll2.Min = 0
    HScroll2.LargeChange = 5
    HScroll2.SmallChange = 1
    HScroll3.Max = 255
    HScroll3.Min = 0
    HScroll3.LargeChange = 5
    HScroll3.SmallChange = 1
    HScroll4.Max = 10
    HScroll4.Min = 1
    HScroll4.LargeChange = 3
    HScroll4.SmallChange = 1
    HScroll5.Max = 10
    HScroll5.Min = 1
    HScroll5.LargeChange = 3
    HScroll5.SmallChange = 1
    '初始化文本框内容
    Text1.Text = "3"
    Text2.Text = "3"
    '设置用于显示颜色的标签控件的边框、背景色
    Label5.BorderStyle = 1
    Label5.BackColor = RGB(0, 0, 0)
End Sub

Private Sub HScroll1_Change()
    '显示标签背景色
    Label5.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
End Sub

Private Sub HScroll2_Change()
    Label5.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
End Sub

Private Sub HScroll3_Change()
    Label5.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
End Sub

Private Sub HScroll4_Change()
    Text1.Text = Str(HScroll4.Value)    'str函数将滚动条数据(数值型)转化为字符型
End Sub

Private Sub HScroll5_Change()
    Text2.Text = Str(HScroll5.Value)
End Sub

Private Sub Text1_Change()
    HScroll4.Value = Val(Text1.Text)   'Val函数将文本框内的字符型数据转化为数值
End Sub

Private Sub Text2_Change()
    HScroll5.Value = Val(Text2.Text)
End Sub
