Author Topic: Acad2017/2018 icons with transparent backgrounds inside .dlls for both themes?  (Read 2516 times)

0 Members and 1 Guest are viewing this topic.

BazzaCAD

  • Guest
As described in this thread:
https://www.theswamp.org/index.php?topic=51285.0

2017 no longer supports the 192 bmp trick. In 2015 I had 2 sets of icons, one for the dark theme & one for the light. My CUI would be named "MyMenu.cuix" the dlls would be "MyMenu.dll" & "MyMenu_light.dll" and AutoCAD would recompile them to "MyMenu.mnr" & "MyMenu_light.mnr". That all worked great & both themes worked as they should.

Now for 2018, I know I need to convert my .bmps to .pngs or .icos, but how then do I get them into my .dll?
I've tried & it doesn't seem to work.

Thanks for the help.

BazzaCAD

  • Guest
Well if anyone is interested, I've now got this process figured out....

First I created a .BAT to convert my .bmp's to .png's
This post was helpfull: http://www.cadforum.cz/cadforum_en/how-to-make-transparent-icons-for-my-cui-ribbon-in-autocad-2017-tip10808

"C:\Program Files (x86)\IrfanView\i_view32.exe" BOLT.bmp /transpcolor=(192,192,192) /convert .\PNG\BOLT.png
"C:\Program Files (x86)\IrfanView\i_view32.exe" NAIL.bmp /transpcolor=(192,192,192) /convert .\PNG\NAIL.png
"C:\Program Files (x86)\IrfanView\i_view32.exe" AB.bmp /transpcolor=(192,192,192) /convert .\PNG\AB.png


Then I created a resource only .dll in Visual Studio.
https://msdn.microsoft.com/en-us/library/24b2tcy0(v=vs.120).aspx

Then I added the .png's to the project.
This post was helpful: http://adndevblog.typepad.com/autocad/2014/08/using-cuix-resource-dll-with-image-transparency.html
(Just the first part, not the creating of the CUIx part)
It says it's for .ico's only & .png's don't work, but they do.

I just edited the .rc file in Notepad++, instead of Visual Studio.

Bolt   RCDATA   "\\\\GECKO\\cad2Kro\\TSEcad2018\\STARTUP\\Icons_dark\\PNG\\Bolt.png"
NAIL   RCDATA   "\\\\GECKO\\cad2Kro\\TSEcad2018\\STARTUP\\Icons_dark\\PNG\\NAIL.png"
AB     RCDATA   "\\\\GECKO\\cad2Kro\\TSEcad2018\\STARTUP\\Icons_dark\\PNG\\AB.png"

(The names in the first column above, have to match the names of the icons defined in your .CUIx file)


Then open VS & compile.


ChrisCarlson

  • Guest
Quick side note, I've found that the size suggestion is simply a suggestion. I'm currently using a 512x512 transparent PNG file which AutoCAD downsizes, quite nicely too I'd add.

BazzaCAD

  • Guest
Quick side note, I've found that the size suggestion is simply a suggestion. I'm currently using a 512x512 transparent PNG file which AutoCAD downsizes, quite nicely too I'd add.

Wouldn't that make you .dll or .cuix quite a bit larger & slower to load from the network?

ChrisCarlson

  • Guest
My largest PNG icon is 178kb, on a GigE lan it's hard to even notice 178mb.