【VB开源代码栏目提醒】:本文主要为网学会员提供Ex13_2.frm,希望对需要Ex13_2.frm网友有所帮助,学习一下!
VERSION 5.00
Begin VB.Form Ex13_2
Caption = "Circle方法的使用"
ClientHeight = 3000
ClientLeft = 60
ClientTop = 450
ClientWidth = 4410
LinkTopic = "Form1"
ScaleHeight = 3000
ScaleWidth = 4410
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "画椭圆"
Height = 375
Left = 120
TabIndex = 2
Top = 840
Width = 855
End
Begin VB.CommandButton Command1
Caption = "画圆弧"
Height = 375
Left = 120
TabIndex = 1
Top = 240
Width = 855
End
Begin VB.CommandButton Command3
Caption = "画圆"
Height = 375
Left = 120
TabIndex = 0
Top = 1440
Width = 855
End
End
Attribute
VB_Name = "Ex13_2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command3_Click() '画圆
Dim Xpos As Integer, Ypos As Integer
Dim Limit As Integer, Radius As Integer
Dim R As Integer, G As Integer, B As Integer
ScaleMode = 3
R = 255 * Rnd ' 颜色为随机数
G = 255 * Rnd
B = 255 * Rnd
Xpos = ScaleWidth / 2
Ypos = ScaleHeight / 2
If Xpos > Ypos Then ' 确定半径的最大值
Limit = Ypos
Else
Limit = Xpos
End If
Cls
For Radius = 0 To Limit ' 循环画出多个半径逐渐增大的同心圆
Circle (Xpos, Ypos), Radius, RGB(R, G, B)
' 窗体的中心为圆心
Next Radius
End Sub
Private Sub Command2_Click() '画圆弧
Const PI = 3.1415926
Cls
Circle (2500, 1500), 1000, vbGreen, -PI / 6, -PI * 2
Circle Step(200, -50), 1000, vbBlue, -PI * 2, -PI / 6
End Sub
Private Sub Command1_Click() '画两个垂直的椭圆
Cls
Circle (2500, 1500), 1200, vbRed, , , 1 / 3
Circle (2500, 1500), 1200, vbRed, , , 3
End Sub