Author Topic: Circlebar Control  (Read 6748 times)

fearless

  • Member
  • ***
  • Posts: 361
    • LetTheLightIn
Circlebar Control
« on: March 26, 2014, 02:22:38 AM »
A circular progress bar control with source, 1 example and chm help file.



Playing around with gdi+ stuff recently and for some reason i ended up creating this. I had tried to create a version where the center part was completely transparent, (i did get a gdi version to work with transparentblt but that the gdi version did not have any anti-aliasing, and still looked a bit rough when rendering at a higher image size and stretchblt back to smaller size), and cpu usage goes up a bit when moving mouse over the window (higher cpu usage if you have a gaming mouse with higher polling rate probably due to increased wm_mousemove messages). Also you might have to right click, properties, unblock, on the chm for it to show properly. Another thing that bothered me slightly was the way i created the control - still not sure im doing that right :D

Anyhows here it is, maybe someone will find it, or the code useful.
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

www.LetTheLight.in  My Github  Twitter

qWord

  • Member
  • *****
  • Posts: 1473
  • The base type of a type is the type itself
    • SmplMath macros
Re: Circlebar Control
« Reply #1 on: March 26, 2014, 03:15:07 AM »
One small issue is that your WndProc does not preserve EBX as required by the WinABI. Otherwise it look goods  :icon14:

BTW: WM_NCCREATE is might not be the first message send to a window (AFAICS this is not a problem for your control). For that reason I prefer the method of a wrapper-WndProc that does manage the memory of the window/control-data and pass the pointer through EBX or an additional parameter to the actual procedure. As long as the private data is not allocated, the wrapper call the default window procedure.
MREAL macros - when you need floating point arithmetic while assembling!

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: Circlebar Control
« Reply #2 on: March 26, 2014, 07:29:36 PM »
Hi fearless,

Looks good.  :t

Gunther
Get your facts first, and then you can distort them.

faiseur

  • Regular Member
  • *
  • Posts: 1
Re: Circlebar Control
« Reply #3 on: May 17, 2014, 06:05:43 AM »
Good work Fearless  :t

Biterider

  • Member
  • **
  • Posts: 230
  • ObjAsm32 - ObjAsm64
    • ObjAsm64
Re: Circlebar Control
« Reply #4 on: May 17, 2014, 04:18:27 PM »
Nice stuff  8)
Biterider

guga

  • Member
  • ****
  • Posts: 848
  • Assembly is a state of art.
    • RosAsm
Re: Circlebar Control
« Reply #5 on: August 10, 2014, 02:21:35 AM »
Crashing on winxp SP3

The crash is at CbarGdiDrawDisplayText
in the 1st GdipDrawString here
Code: [Select]
        mov eax, MarkerNo
       
        .IF eax == 0
            Invoke GdipDrawString, pGraphics, Addr szWZero, 0ffffffffh, pFont, Addr gdirect, pFormat, pBrush


http://www.jose.it-berater.org/smfforum/index.php?topic=1826.0
http://www.masmforum.com/board/index.php?PHPSESSID=786dd40408172108b65a5a36b09c88c0&topic=11385.0
http://msdn.microsoft.com/en-us/library/windows/desktop/ms534053%28v=vs.85%29.aspx


http://www.wasm.ru/forum/viewtopic.php?id=45877
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

fearless

  • Member
  • ***
  • Posts: 361
    • LetTheLightIn
Re: Circlebar Control
« Reply #6 on: August 10, 2014, 11:02:05 AM »
I copied the circlebarexample1 to my old asus n10 netbook (winxp pro sp3 with an intel atom cpu), and it runs without crashing, altho the desktop and other screens flicker and the cpu goes mad. I can only think it is something to do with the gdiplus version on xp vs win7 x64 maybe. Tbh i never tested it on the netbook before as i hardly ever use it.
I done a search of gdiplus on my netbook and my main pc (win7 x64) and took screenshots of the files listed, altho im not sure it will help at all, but i suppose its a place to start.




fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

www.LetTheLight.in  My Github  Twitter

guga

  • Member
  • ****
  • Posts: 848
  • Assembly is a state of art.
    • RosAsm
Re: Circlebar Control
« Reply #7 on: August 10, 2014, 11:21:09 AM »
The problem seems to be that pFont is returning 0-1, causing GdipDrawString to crash

It is retrning 0-1, because at GdipCreateFont it returns 2 (which i suppose is an error case), when it should return 0
http://source.winehq.org/WineAPI/GdipCreateFont.html
http://www.news2news.com/vfp/?function=805

Since GdipCreateFont return error on the 1st time it is being used, i presume the error is at the function CbarGdiInit
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

fearless

  • Member
  • ***
  • Posts: 361
    • LetTheLightIn
Re: Circlebar Control
« Reply #8 on: August 10, 2014, 11:53:19 AM »
Might be coz i have specified Segoe UI as the font to use, which according to the wikipedia entry http://en.wikipedia.org/wiki/Segoe is on windows 7 upwards and can be available on winxp if particular software applications are installed. Might have to set it as arial or something and recompile it.

Change these lines in the source:
Code: [Select]
szDefaultFont           db "Segoe UI",0
szWDefaultFont        db "S",0,"e",0,"g",0,"o",0,"e",0," ",0,"U",0,"I",0,0,0
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

www.LetTheLight.in  My Github  Twitter

guga

  • Member
  • ****
  • Posts: 848
  • Assembly is a state of art.
    • RosAsm
Re: Circlebar Control
« Reply #9 on: August 10, 2014, 12:17:32 PM »
Indeed

Changing it to times new roman, worked correctly :)

Very nice example of using gdi+, btw  :t
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

HSE

  • Member
  • ****
  • Posts: 829
  • <AMD>< 7-32>
Re: Circlebar Control
« Reply #10 on: July 25, 2018, 12:41:46 AM »
Hi Fearless!!

Perhaps a posible development is an option for isometric or not isometric control.

There is some small issue when control itsn't isometric (and also a white line):



fearless

  • Member
  • ***
  • Posts: 361
    • LetTheLightIn
Re: Circlebar Control
« Reply #11 on: July 25, 2018, 04:44:31 AM »
Thanks,
Not sure if I will get a chance to look into it, might look to re-adapt/rewrite it at some point in future. Might just be the angles or sizing of some stuff is slightly off somewhere. Dont think i ever tested it for that kind of shape.
I do remember when creating it I was looking for a solution to 'cut out' the center, so that it would be transparent to what was underneath - probably due to clipping it wouldnt be, so would have to capture background of parent and paint that instead.
I remember thinking about the possibilities of having different shapes for other types of controls, semi-circular and the like (from -90 to 90 degree for example) for other gauges etc. But that was a long time ago.
Also the calculation for figuring out the placement of text around the circle was a bit of a pain from what i remember - probably could be optimized better.

Thanks for letting me know about that issue.
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

www.LetTheLight.in  My Github  Twitter

HSE

  • Member
  • ****
  • Posts: 829
  • <AMD>< 7-32>
Re: Circlebar Control
« Reply #12 on: July 25, 2018, 06:13:52 AM »
Dont think i ever tested it for that kind of shape.

Automatic resize  :biggrin:


fearless

  • Member
  • ***
  • Posts: 361
    • LetTheLightIn
Re: Circlebar Control
« Reply #13 on: July 25, 2018, 06:48:02 AM »
Graph looks nice, is that a third party control or something you created? Do you have it available as a bundled control? Graph controls are something that has been on my list of things to check into at some point.
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

www.LetTheLight.in  My Github  Twitter

HSE

  • Member
  • ****
  • Posts: 829
  • <AMD>< 7-32>
Re: Circlebar Control
« Reply #14 on: July 25, 2018, 07:27:54 AM »
Graph looks nice
Thanks. It's under eternal development.

Something more solid is here