Dim x, y As Integer
Dim Astart, Aend, Radius, ProdA, ProdB, ProdC As Integer
Dim Aspect As Single
Const pi = 3.14159265
Dim StartA As Single
Dim EndA As Single
Dim StartB As Single
Dim EndB As Single
Dim StartC As Single
Dim EndC As Single
Private Sub cmdClose_Click()
End 'ends program
End Sub
Private Sub cmdPie_Click()
StartA = Astart - 0.001
EndA = 60 * pi / 180
picView.FillColor = vbBlue
Debug.Print
picView.Circle (x, y), Radius, vbBlack, -StartA, -EndA, Aspect
StartB = EndA + StartA
EndB = 120 * pi / 180
're-draw the circle
picView.FillColor = vbRed
Debug.Print
picView.Circle (x, y), Radius, vbBlack, -StartB, -EndB, Aspect
StartC = EndB + StartB
EndC = 180 * pi / 180
picView.FillColor = vbYellow
're-draw the circle
picView.Circle (x, y), Radius, vbBlack, -StartC, -EndC, Aspect
Debug.Print
End Sub
Private Sub cmdStyle_Click()
'change the drawstyle property setting of the picture control(0-6)
picView.DrawStyle = (picView.DrawStyle + 1) Mod 7
picView.Cls 're-draw the circle
picView.Circle (x, y), Radius, vbBlack, -Astart, -Aend, Aspect
End Sub
Private Sub Form_Load()
Show 'force the form to be made visable
'otherwise the circle will not be drawn
Initialise 'to establish the start up values
End Sub
Sub Initialise()
x = picView.ScaleWidth / 2 'the center of the circle
y = picView.ScaleHeight / 2
Radius = hsbRadius.Value * 20 'scaleup the scroll bar value
Aspect = hsbAspect.Value / 10 'scale down the scollbar value
Astart = hsbStart.Value / 360 * 2 * pi 'convert to radians
Aend = hsbEnd.Value / 360 * 2 * pi 'covert to radians
picView.Circle (x, y), Radius, vbBlack, -Astart, -Aend, Aspect
End Sub
Private Sub hsbAspect_Change()
Aspect = hsbAspect.Value / 10 'change the aspect value
txtAspect.Text = Aspect 'update the textbox
picView.Cls 're-draw the circle
picView.Circle (x, y), Radius, vbBlack, -Astart, -Aend, Aspect
End Sub
Private Sub hsbEnd_Change()
Aend = hsbEnd.Value / 360 * 2 * pi 'change the end angle value
picView.FillColor = vbBlue
txtEnd.Text = hsbEnd.Value 'update the text box
'picView.FillColor = vbRed 'fills the colour red for pie chart
picView.FillStyle = 0
picView.Cls 're-draw the circle
picView.Circle (x, y), Radius, vbBlack, -Astart, -Aend, Aspect
End Sub
Private Sub hsbRadius_Change()
Radius = hsbRadius.Value * 20 'change the radius value
txtRadius.Text = Radius 'update the textbox
picView.Cls 're-draw the circle
picView.Circle (x, y), Radius, vbBlack, -Astart, -Aend, Aspect
End Sub
Private Sub hsbStart_Change()
Astart = hsbStart.Value / 360 * 2 * pi ' change the start angle value
txtStart.Text = hsbStart.Value - 0.09 ' update the textbox
picView.Cls 're-draw the circle
picView.Circle (x, y), Radius, vbBlack, -Astart, -Aend, Aspect
End Sub
Private Sub hsbWidth_Change()
picView.DrawWidth = hsbWidth.Value 'change the width of the line
txtWidth.Text = picView.DrawWidth 'update the textbox
picView.Cls 're-draw the circle
picView.Circle (x, y), Radius, vbBlack, -Astart, -Aend, Aspect
End Sub