怎么用VB画一个环形?内外都是椭圆,可以设置大小,环形中间填充颜色,最好能转,谢谢了

2024-12-13 17:01:55
推荐回答(2个)
回答1:

Dim x As Single, y As Single, r As Integer

Private Sub HScroll1_change()
HScroll1.Min = 0
HScroll1.Max = 750
r = HScroll1.Value
End Sub

Private Sub Command2_Click()
Dim m As Integer
m = Text1.Text
p = 3.14
For j = 1 To m
x = 1750 + 750 * Cos((2 * p * j) / m)
y = 2000 + 750 * Sin((2 * p * j) / m)
Picture1.Circle (x, y), r
Next j
End Sub
Private Sub Picture1_Click()
Picture1.Cls
End Sub
Private Sub Command1_Click()

Dim n As Integer, i As Integer
p = 3.14
n = InputBox("请输入等分圆的份数")
For i = 1 To n
x = 1750 + 750 * Cos((2 * p * i) / n)
y = 2000 + 750 * Sin((2 * p * i) / n)
Picture1.Circle (x, y), 750
Next i
End Sub

回答2:

Private Sub Form_load()
Cls
Form1.ScaleLeft = 0.5
Form1.ScaleHeight = 2
Form1.ScaleWidth = 3.5
Cls
Form1.Circle (2, 1), 0.4, , , , 2.5
Form1.Circle (2, 1), 0.2, , , , 2
End Sub