# Cool Loading Wheel Control - Open Source

**URL:** <https://forum.xojo.com/t/cool-loading-wheel-control-open-source/22006>\
**Category:** General\
**Created:** [January 31, 2015, 7:51pm UTC](https://forum.xojo.com/t/cool-loading-wheel-control-open-source/22006 "2015-01-31T19:51:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [January 31, 2015, 7:51pm UTC](https://forum.xojo.com/t/cool-loading-wheel-control-open-source/22006/1 "2015-01-31T19:51:59Z")

</div>

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.

Github Repo:  
[https://github.com/IntelligentVisibility/CoolLoadingWheelControl](https://github.com/IntelligentVisibility/CoolLoadingWheelControl)

![](http://i58.tinypic.com/286zhjq.png)

---

<div class="post-metadata">

**Author:** ![Axel\_Schneider](https://forum.xojo.com/user_avatar/forum.xojo.com/axel_schneider/32/465_2.png) [@Axel\_Schneider](https://forum.xojo.com/u/Axel_Schneider)\
**Post date:** [January 31, 2015, 8:56pm UTC](https://forum.xojo.com/t/cool-loading-wheel-control-open-source/22006/2 "2015-01-31T20:56:11Z")

</div>

Thank You!

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

```auto
  // ---------- 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.ForeColor = &cFFFFFF //blank mask
  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
  
  // DRAW LOADING STRING
  Dim CenterString as String = "Loading..."
  g.TextFont = "System"
  g.ForeColor = kBlue
  g.TextSize = me.Width / 10
  Dim xPos as Integer = ((self.Width/2)-(g.stringwidth("Loading...")/2))+2
  Dim yPos as Integer = ((self.Height/2)-(g.textsize/2)) + g.textsize
  g.DrawString(CenterString, xPos, yPos)
```

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [January 31, 2015, 10:54pm UTC](https://forum.xojo.com/t/cool-loading-wheel-control-open-source/22006/3 "2015-01-31T22:54:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![S\_Abraham](https://forum.xojo.com/user_avatar/forum.xojo.com/s_abraham/32/4865_2.png) [@S\_Abraham](https://forum.xojo.com/u/S_Abraham)\
**Post date:** [February 1, 2015, 5:27am UTC](https://forum.xojo.com/t/cool-loading-wheel-control-open-source/22006/4 "2015-02-01T05:27:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Axel\_Schneider](https://forum.xojo.com/user_avatar/forum.xojo.com/axel_schneider/32/465_2.png) [@Axel\_Schneider](https://forum.xojo.com/u/Axel_Schneider)\
**Post date:** [February 1, 2015, 2:46pm UTC](https://forum.xojo.com/t/cool-loading-wheel-control-open-source/22006/5 "2015-02-01T14:46:11Z")

</div>

> [@163730:@S Abraham](#):
>
> Thanks Mike for the control. On Windows it is having a heavy flicker. How to avoid that

in CoolWheelContainer set CoolWheelControl DoubleBuffer to ‘ON’

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [February 1, 2015, 4:11pm UTC](https://forum.xojo.com/t/cool-loading-wheel-control-open-source/22006/6 "2015-02-01T16:11:46Z")

</div>

> [@163730:@S Abraham](#):
>
> Thanks Mike for the control. On Windows it is having a heavy flicker. How to avoid that

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)

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:36pm UTC](https://forum.xojo.com/t/cool-loading-wheel-control-open-source/22006/7 "2020-10-29T17:36:47Z")

</div>


