Microsoft Small Basic

Program Listing: QRH345
' Challenge of month Oct. 2013 Progress bar by NaochanON

GraphicsWindow.Hide()
GraphicsWindow.Width=800
GraphicsWindow.Height=200
getbar()
GraphicsWindow.Show()
Timer.Tick = OnTimerTick
Timer.Interval=1000

Sub OnTimerTick
count=count+1
len= Math.Remainder(count,10)
GraphicsWindow.Title=" Count= "+len
If len=0 Then
getbar()
Shapes.SetText(msg[NN-1],count)
Else
Shapes.SetOpacity(bar[NN],80)
Shapes.Zoom(bar[NN],len/10,1)
Shapes.Move(bar[NN],50+len/10*50+(NN-1)*100,50)
Shapes.SetText(msg[NN],count)
Shapes.Zoom(msg[NN],len/5,1)
Shapes.Move(msg[NN],90+len/10*30+(NN-1)*100,50)
EndIf
EndSub

Sub getbar
NN=NN+1
If NN=7 Then
For i=1 To 6
Shapes.Remove(bar[i])
Shapes.Remove(msg[i])
EndFor
NN=1
count=0
EndIf
color= GraphicsWindow.GetRandomColor()
GraphicsWindow.BrushColor=color
GraphicsWindow.PenColor=color
bar[NN]=Shapes.AddRectangle(100,100)
Shapes.Move(bar[NN],-500,50)
GraphicsWindow.BrushColor="red"
GraphicsWindow.FontSize=30
msg[NN]= Shapes.AddText(" ")
Shapes.Move(msg[NN],-500,50)
endsub