Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") 'Load the layout file.
MainForm.Show
Dim parent As B4XView = MainForm.RootPane
Dim bars As List = CreateBars(200dip, 50dip, 10)
For i = 1 To 10
Dim iv As ImageView
iv.Initialize("")
Dim xiv As B4XView = iv
parent.AddView(xiv, 20dip, 55dip * i, 200dip, 50dip)
xiv.SetBitmap(bars.Get(i))
Next
End Sub
Sub CreateBars (Width As Int, Height As Int, MaxBars As Int) As List
Dim res As List
res.Initialize
Dim pnl As B4XView = xui.CreatePanel("")
pnl.SetLayoutAnimated(0, 0, 0, Width, Height)
Dim cvs As B4XCanvas
cvs.Initialize(pnl)
Dim gap As Int = 2dip
Dim BarWidth As Int = Width / MaxBars - gap
Dim BarHeightInterval As Int = Height / MaxBars - gap
For i = 0 To MaxBars
cvs.ClearRect(cvs.TargetRect)
For b = 1 To i
Dim r As B4XRect
r.Initialize((b - 1) * (BarWidth + gap), cvs.TargetRect.Height - gap - b * BarHeightInterval, 0, cvs.TargetRect.Height - gap)
r.Width = BarWidth
cvs.DrawRect(r, xui.Color_Red, True, 0)
Next
res.Add(cvs.CreateBitmap)
Next
cvs.Release
Return res
End Sub