Thanks to the original work of @Tomas Jakobs and the smooth math by @Will Shank we have the “Cool Loading Wheel Control”. I have added a behavior type and I was thinking that we could possibly add additional behaviors.

Thank You!

I changed CoolWheelCanvas.Paint to get better result on reiszing CoolWheelContainer1

// ---------- CODE BLOCK THANKS TO WILL SHANK
static p As Picture
if p = nil or p.Width <> Width or p.Height <> Height then
p = new Picture(Width, Height, 32) //Mask
end

dim gg As Graphics = p.Mask.Graphics
gg.FillRect(0, 0, Width, Height)

gg.ForeColor = &c000000         //draw ring outer
gg.FillOval(0, 0, Width, Height)
gg.ForeColor = &cFFFFFF         //draw ring inner
gg.FillOval(g.width / 4, g.height / 4, Width-g.width / 2, Height-g.height / 2)

gg = p.Graphics
gg.ForeColor = &cAAAAAA         //fill ring color
gg.FillRect(0, 0, Width, Height)

dim xy(0), cx, cy, r As integer //build wedge poly
cx = Width * 0.5
cy = Height * 0.5
r = Width
xy.Append cx
xy.Append cy
for i As integer = 0 to percentage
xy.Append cx + r * cos(i)
xy.Append cx - r * sin(i)
next
xy.Append cx + r * cos(percentage)
xy.Append cx - r * sin(percentage)

gg.ForeColor = kBlue //ChangeRingColor()

gg.FillPolygon(xy)

g.DrawPicture p, 0, 0
// ---------- THANKS WILL

g.TextFont = "System"
g.ForeColor = kBlue
g.TextSize = me.Width / 10
Dim yPos as Integer = ((self.Height/2)-(g.textsize/2)) + g.textsize
g.DrawString(CenterString, xPos, yPos)

Thanks Axel! I just made those changes and committed them.

Thanks Mike for the control. On Windows it is having a heavy flicker. How to avoid that

in CoolWheelContainer set CoolWheelControl DoubleBuffer to ‘ON’

Switch to a Mac? Just kidding as Axel has the answer above

I implemented Axel’s recommendation and committed them to the repo to help theWindows Flicker:

• Added #IF TARGET statement for Windows to turn on DoubleBuffering (CoolWheelCanvas.Open)
• Added #IF TARGET statement for Windows to turn on UseGDIPlus = True (App.Open)