Compile png for toolbar buttons to dll?

Compile png for toolbar buttons to dll?

JamesMaeding
Advisor Advisor
1,061 Views
7 Replies
Message 1 of 8

Compile png for toolbar buttons to dll?

JamesMaeding
Advisor
Advisor

I realized a few users liked the "dark" theme so wanted to make my toolbar button backgrounds transparent instead of 192,192,192.

I first saved the images to png using (free) image magick using "convert *.bmp *.png" (or similar I forget, its trivial if you look at the help).

I then replaced the grey with transparency also with image magick and this batch code (not trivial):

"C:\Program Files\ImageMagick-7.0.5-Q8\magick.exe" mogrify -fuzz 3% -transparent "rgb(192,192,192)" "C:\CAD_Support\Menu Bitmap Dlls 2015+\HATools\*.png"

 

So, now I have happy png's with transparent backgrounds.

I use .mnu and a typical toolbar button looks like this:

[_Button("HATCHOFF", 03_HATOFF, 03_HATOFF)]-LAYER;OFF;*HATCH*;;

I tested and found if I add .png like this:

[_Button("HATCHOFF", 03_HATOFF.png, 03_HATOFF.png)]-LAYER;OFF;*HATCH*;;

and put the png's in the menu folder, it works. The pngs get included in the cuix when it loads the mnu.

 

I prefer imaged compiled to dll though, as its separate from the .cuix so easier to manage since I support multiple versions of acad (down to 2015).

What I want to do is compile the png's to dll, and I use rc.exe to make the .res file in VS, but its not working with .png.

It says they are not "version 3.0..." which I read is saying they are not types valid for resource file.

Is dll not an optionif you want png's?

Also, I tried hand "packing" the png's into a cuix, instead of having them in same folder as .mnu.

It did not work. Maybe I forgot something but I loaded the .mnu without images, got all ?'s, then added the png's later. Its like if they are not there when the cuix compiles from .mnu, it will not "find" them in the cuix later. Does that sound right?

thanks

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
1,062 Views
7 Replies
Replies (7)
Message 2 of 8

dgorsman
Consultant
Consultant

A couple of quick searches don't turn up any solutions for PNG, only ICO e.g.

 

https://forums.autodesk.com/t5/net/again-about-supporting-dark-and-light-themes-for-custom-cui/m-p/6...

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 3 of 8

JamesMaeding
Advisor
Advisor

@dgorsman

thanks for the reply, I also found that so I think png is not ok for a resource file. Maybe the transparency is the problem but the whole reason you go png is for alpha.

Looks like I have to have the png's in same folder when I make the cuix, then remove after.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 4 of 8

dgorsman
Consultant
Consultant

Have a look here: https://en.wikipedia.org/wiki/ICO_(file_format).  That seems to suggest the ICO file hosts a PNG file, complete with transparency.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 5 of 8

ActivistInvestor
Mentor
Mentor

Have a look at this thread.

 


@JamesMaedingwrote:

 

thanks for the reply, I also found that so I think png is not ok for a resource file. Maybe the transparency is the problem but the whole reason you go png is for alpha.

Looks like I have to have the png's in same folder when I make the cuix, then remove after.


 

Message 6 of 8

JamesMaeding
Advisor
Advisor

@ActivistInvestor

oh geeze, I needed to change the word bitmap to png in my .rc file.

I thought bitmap meant "grid of pixels" not the literal bmp format. good stuff!


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 7 of 8

JamesMaeding
Advisor
Advisor

well, its not working, even though I can compile the dll successfully. The thread @ActivistInvestor mentioned never said if the dll will work in acad, just that it can be created. One person there said it was not working in 2017, so that is one downvote and no upvotes for pngs in a dll.

The comment on adding by hand to cuix and tweaking the xml is slick though.

In the end, this kind of sucks. I have to either keep one set of png's and hand pack the pngs into the cuix's, or keep a copy of the pngs in every folder where my menus are for 4 acad versions.

If I could just find someone that knows png's in a dll do work that would give me hope.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 8 of 8

JamesMaeding
Advisor
Advisor

I missed some info, and indeed I must go .ico not png.

Shouldn't be too hard, just needed to bark up the right tree.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties