Custom Icon Inventor

Custom Icon Inventor

Anonymous
Not applicable
3,815 Views
13 Replies
Message 1 of 14

Custom Icon Inventor

Anonymous
Not applicable

Hi,

 

I am trying to create a custom Icon for my macro... several online sources say that if I place an bmp image along with the macros. IVB file ussing the following format

 

ModuleName.MacroName.Small.bmp

ModuleName.MacroName.Large.bmp

 

and place these in the same directory of my IVB file that my Icons will change to the image I have defined. This just dosnt work for me and the default Macro icon image is still used. the module futhermore runs fine...

 

I cant personally see whats going wrong but I get the feeling I may have not defined my macro properly????

 

1.png

 

2.png

 Source of information:

 

http://modthemachine.typepad.com/my_weblog/2010/03/buttons-for-vba-macros-in-the-ribbon-user-interfa...

 

0 Likes
3,816 Views
13 Replies
Replies (13)
Message 2 of 14

mr_ensing
Advocate
Advocate

Edit: it seems i reacted on an old thread. Oh well.

 

Check the resolution of the images. 16x16 pixels for small. 32x32 pixels for large. 

Other than that, i don't see much wrong with it. I ran a quick test:

 

 

Naamloos.png

 

0 Likes
Message 3 of 14

Anonymous
Not applicable

hi.

where is this directory where to put the icone files?

0 Likes
Message 4 of 14

mr_ensing
Advocate
Advocate
0 Likes
Message 5 of 14

kfc10
Participant
Participant

Hi,

Yes the bmp image type is working. For a dark background, it doesn't meet my expectations.

I need to create a transparent background. That is, for the png image type, or for using the ico type. Vba does not work for these types. Please confirm my findings. Or is there any other trick for using png and ico?

0 Likes
Message 6 of 14

mr_ensing
Advocate
Advocate

Is far as I know, with VBA, .bmp-files are your only option. So yeah, transparency is not a possibility.

For icons with transparency, you'll have to create a addin I guess.

Message 7 of 14

kfc10
Participant
Participant

Thank you for answer. I stay at the Global Forms panel there I can put ico images. It's sad, that it does not work for program version 2022.

0 Likes
Message 8 of 14

freesbee
Collaborator
Collaborator

I can confirm that in VBA area the only option is bmp, so no transparency.

In the addin area, then more flexibility is offered (ico files are supported if I remember it right).

By the time of concept of DarkMode (2017) I have strongly asked to offer support for Cobalt, Amber and Dark themes at least on AddIn level...

...unfortunately the result was that "Amber" has been discontinued in dark mode (even if many of us love "Dark/Amber"), and I have never seen anything on how to switch icons between light and dark mode.

I have received a wonderful "Inventor UI Guidelines for Custom" (attached) that helps you making your addin consistent with the rest of the program, but never something specific on the "Light/Dark" theme switch.

@jason_hetu: Maybe somebody at Autodesk could clarify the real situation?

Massimo Frison
CAD R&D // PDM Admin · Hekuma GmbH
Message 9 of 14

jason_hetu
Autodesk
Autodesk

Hi everyone, 

I talked with some of the developers who have some more detailed information on solutions to these issues.

  1. Light and Dark theme: 

    Before creating a button (ControlDefinitions.AddButtonDefinition), check the value of Application.ThemeManager.ActiveTheme.Name. This is a string that can be either "LightTheme" or  "DarkTheme". Choose your icons based on that.

     

    To support a change in theme during a session:
    Listen to the ApplicationEvents.OnApplicationOptionChange event. In your event handler, look at the current value of Application.ThemeManager.ActiveTheme.Name and compare it to a value that you have previously cached. If it has changed, iterate over your cached ButtonDefinition objects and change their StandardIcon and LargeIcon properties.

    (You can cache the value in the event handler when the BeforeOrAfter argument is EventTimingEnum.kBefore. Then check if the value has changed when the BeforeOrAfter argument is EventTimingEnum.kAfter).

  2. Amber Support:
    We continue to support amber but only for the light theme. We are not creating any new icons in the amber style but will leave all the ones that currently exist. The reason we don't have an amber option in dark theme is that these icons are built for the light theme and will have aliasing issues with light pixels at the edges or not have the correct level of contrast due to the fact that they are designed to work on the light background color. 

    The developers said that you can check the API to get the icon style similar to the theme color and update accordingly (amber or cobalt).
  3. Icon Transparency Support:
    There have been some similar questions asked and answered in this: Inventor Beta Forum Post.
    If you are not a member you can sign up here: https://feedback.autodesk.com/
Message 10 of 14

freesbee
Collaborator
Collaborator

...thank you so much Jason.

Great answer, as usual from you!!

Massimo Frison
CAD R&D // PDM Admin · Hekuma GmbH
0 Likes
Message 11 of 14

g.georgiades
Advocate
Advocate

Hi,

 

For transparency in the VBA icons, Inventor sets all magenta pixels (255, 0, 255) as transparent.

You have to restart inventor to see icon changes.

Message 12 of 14

mr_ensing
Advocate
Advocate

I tried that years ago, but it did not work. Forgot all about it.

Just tried again, works fine now. Thanks for the reminder.

0 Likes
Message 13 of 14

mr_ensing
Advocate
Advocate

Some experiences with transparency by using magenta. There is transparency, but only full transparency.

 

So not what i tried to do:

Transparency03.png

 

The result of that is:

Transparency01.png

Icontest1 has a white background, magenta for Icontest2.

 

So no fuzzy edges and everything is fine

Transparency02.png

 

 

0 Likes
Message 14 of 14

jason_hetu
Autodesk
Autodesk

Usually what we do if we need to create these type of icons is we will use the background color. Then fill in the part we want to be transparent with the magenta color. This will provide a similar result to your final image but it will look smoother. We use this type of icon for the browser. You may notice that hovers with different background colors show a little of this aliasing but it is better than no transparency.

0 Likes