Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Guidance for creating dialogs with the new dockable Panel UI

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
DRoam
696 Views, 5 Replies

Guidance for creating dialogs with the new dockable Panel UI

Inventor recently got the new Property Panel-style dockable panels that look really nice and can switch between the Light theme and the new Dark theme. I'm familiar with creating add-ins, but all of my dialogs are classic "Windows Forms" dialogs. I'd really like to start transitioning to the modern Panel style, both because it looks nicer and because I want my tools to feel more integrated with Inventor.

 

However, I have no idea where to begin. I've found some older threads and documentation on creating dockable panels, but I'm unsure whether these will end up looking like the newer modern panels that are both light- and dark-theme compatible.

 

I was hoping someone could point me to a good resource, or even be willing to post a guide themselves if one doesn't exist already. I'm sure this is something many developers will want to start implementing.

 

@LukeDavenport's new Duplicate Replacer add-in is an excellent example of what I'd like to achieve (video demo here). (Would greatly appreciate your tips or guidance, Luke, if you're willing to share any!)

 

Any tips on how to get started, or better yet full guidance on the process, would be greatly appreciated. Thanks!

5 REPLIES 5
Message 2 of 6
LukeDavenport
in reply to: DRoam

Hi @DRoam thanks for the shout out. I'm afraid there's nothing particularly fancy under the bonnet for the Duplicate Replacer app UI - its a bog standard Winform, added as a UserControl to a DockableWindow (the ones that were introduced sometime around Inventor 2017/2018 I think?). The handling of the light and dark theme is simply checking for which theme is active using the function below (C#) and changing all the ForeColor and BackColour properties of all the controls, and also loading different images for buttons etc. based on the active theme. Quite a lot of work to be honest, but satisfying.

 

Definitely one of the best investments you could make is a decent icon design program - I use IcoFX which is fantastic.

Good luck!

Luke

 

  public static bool IsDarkThemeActive(Inventor.Application InvApp)
    {
        if (InvApp.SoftwareVersion.Major > 24) // 2021 or later
        {
            if (InvApp.ThemeManager.ActiveTheme.Name.ToUpper().Contains("DARK"))
            {
                return true;
            }
        }
        return false;
    }

 

Message 3 of 6

Would be very interested if someone has a good code sample for these new-fangled auto-theme-identifying dockable windows you mention! 🙂

Message 4 of 6
DRoam
in reply to: LukeDavenport


@LukeDavenport wrote:

I'm afraid there's nothing particularly fancy under the bonnet for the Duplicate Replacer app UI - its a bog standard Winform [...] Quite a lot of work to be honest, but satisfying.


 

Hi Luke, thanks very much for the response! Wow, that makes it even more impressive! On the one hand that's a bummer because it means I have a lot of work ahead of me... lol. But on the other hand, it means I don't need to learn a new forms technology like WPF, so that's a plus! Long live "outdated" WinForms....

 

And thanks for the tip about the icon editor, that's actually really helpful. Up till now I've been stitching together my icons with a mixture of PowerPoint and MS Paint, which is about as painful as it sounds 😅 I've been wanting to use a better tool but wasn't sure which one to get. I will definitely look into IcoFX, it looks affordable which is great.

 


@LukeDavenport wrote:

Would be very interested if someone has a good code sample for these new-fangled auto-theme-identifying dockable windows you mention!


 

Haha, after reading what it takes with WinForms I agree! But I'm afraid it may have been a figment of my wishful imagination. Between the Property Panels and your add-in, which looks seamlessly integrated, I was hoping there was perhaps some magical class library of Form controls in the SDK that takes care of the color-theme styling. Would be great to have in the future if it's possible? Even just a library of the colors would be helpful (WindowBackColor_Light, WindowBackColor_Dark, ButtonBackColor_Light, ButtonBackColor_Dark, etc.).

 

But in the meantime I'll set out with the method you described. You're right, if the end result looks like it's part of Inventor like the Duplicate Replacer does, it will be a lot of work but satisfying!

 

Thanks again for the helpful tips.

Message 5 of 6
DRoam
in reply to: LukeDavenport

Going to go ahead and accept Luke's answer as the solution; but any other tips and suggestions that anyone has are still welcome! Thanks again for the guidance, Luke.

Message 6 of 6
samuelbryner
in reply to: DRoam

It seems to me that the right classes to use are Autodesk.UIModel.CmdPanel and UIMCmdPanel, which are defined in AdUIModel.dll  C:\Program Files\Autodesk\Inventor 2021\Bin\). However, I haven't been able to figure out how to actually use them, as there seems to be absolutely no documentation on them whatsoever (shame on you Autodesk!).

 


@DRoam wrote:
Even just a library of the colors would be helpful (WindowBackColor_Light, WindowBackColor_Dark, ButtonBackColor_Light, ButtonBackColor_Dark, etc.).

I think those are defined in C:\Program Files\Autodesk\Inventor 2021\Bin\Themes

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report