VB中画饼图显示比列的问题!

来源:百度知道 编辑:UC知道 时间:2024/09/23 00:32:30
Option Explicit
Dim a!
Dim b!
Dim c!

Private Sub Form_Click()

a = InputBox("输入手机销售额")
b = InputBox("输入电脑销售额")
'c = InputBox("输入电冰箱销售额")
a = a / (a + b)
'b = b / (a + b)
'c = c / (a + b)
Call PaintBaseCircle
End Sub

Private Sub PaintBaseCircle()
Dim PI As Double 'π
Dim fPercent1 As Single
'Dim fPercent2 As Single
Dim iRadius As Integer
PI = Atn(1) * 4

fPercent1 = Format(a, "0.00")
'fPercent2 = Format(b, "0.00")
fPercent1 = -2 * PI * fPercent1
'fPercent2 = -2 * PI * fPercent2

Me.FillStyle = 0
Me.FillColor = &HC00000 '蓝色
Me.Circle (Me.ScaleWidth / 2, (Me.ScaleHeight / 2) + 50), 1000, &HC00000, , , 0.6

Me.FillColor = &HFF00FF '粉色
Me.Circle (Me.ScaleWidth / 2, Me.ScaleHeight / 2), 1000, &HFF00FF, -2 * PI, fPercent1, 0.6

'Me

Option Explicit
Dim a!
Dim b!
Dim c!

Private Sub Form_Click()
Dim d!, e!, f!
d = InputBox("输入手机销售额")
e = InputBox("输入电脑销售额")
f = InputBox("输入电冰箱销售额")
a = d / (d + e + f)
b = e / (d + e + f)
c = f / (d + e + f)
Call PaintBaseCircle
End Sub

Private Sub PaintBaseCircle()
Dim PI As Double 'π
Dim fPercent1 As Single
Dim fPercent2 As Single
Dim iRadius As Integer
PI = Atn(1) * 4

fPercent1 = Format(a, "0.00")
fPercent2 = Format(b, "0.00")
fPercent1 = -2 * PI * fPercent1
fPercent2 = -2 * PI * fPercent2

Me.FillStyle = 0
Me.FillColor = &HC00000 '蓝色
Me.Circle (Me.ScaleWidth / 2, (Me.ScaleHeight / 2) + 50), 1000, &HC00000, , , 0.6 '饼底

Me.FillColor = &HFF0000 '蓝色
Me.Circle (Me.ScaleWidth / 2, Me.ScaleHeight / 2), 1000, &HFF0000, , , 0.6 '饼面

Me.Fi