Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private pnlCircles As B4XView
Private cvsCircles As B4XCanvas
Private X0, Y0, BigRadius As Int
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
cvsCircles.Initialize(pnlCircles)
X0 = pnlCircles.Width / 2
Y0 = pnlCircles.Height / 2
BigRadius = 120dip
DrawCircles
End Sub
Private Sub DrawCircles
Private Angle As Double
Private R1, R2 As Int
R1 = 4dip
R2 = 6dip
cvsCircles.DrawCircle(X0, Y0, BigRadius, xui.Color_Black, False, 1dip)
For Angle = 0 To 350 Step 10
If (Angle Mod 40) = 0 Then
DrawCircle(Angle, R2, xui.Color_Red)
Else
DrawCircle(Angle, R1, xui.Color_RGB(Rnd(0, 255), Rnd(0, 255), Rnd(0, 255)))
End If
Next
End Sub
Private Sub DrawCircle(Angle As Double, Radius As Int, Color As Int)
Private x, y As Int
x = X0 + BigRadius * CosD(Angle)
y = Y0 + BigRadius * SinD(Angle)
cvsCircles.DrawCircle(x, y, Radius, Color, True, 1dip)
End Sub