News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Circlebar Control

Started by fearless, March 26, 2014, 02:22:38 AM

Previous topic - Next topic

fearless

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.

qWord

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

Hi fearless,

Looks good.  :t

Gunther
You have to know the facts before you can distort them.

faiseur


Biterider

Nice stuff  8)
Biterider

guga

Crashing on winxp SP3

The crash is at CbarGdiDrawDisplayText
in the 1st GdipDrawString here

        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

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.





guga

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

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:
szDefaultFont           db "Segoe UI",0
szWDefaultFont        db "S",0,"e",0,"g",0,"o",0,"e",0," ",0,"U",0,"I",0,0,0


guga

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

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):


Equations in Assembly: SmplMath

fearless

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.

HSE

Quote from: fearless on July 25, 2018, 04:44:31 AM
Dont think i ever tested it for that kind of shape.

Automatic resize  :biggrin:

Equations in Assembly: SmplMath

fearless

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.

HSE

Quote from: fearless on July 25, 2018, 06:48:02 AM
Graph looks nice
Thanks. It's under eternal development.

Something more solid is here
Equations in Assembly: SmplMath