- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
Just looking for advice on how people are creating their apps for Inventor. I've run into this problem with scaling after creating a winform interface for my add-in using the Add-In template for 2022. I was able to set this up to compile as either an .exe or .dll with the same project by switching the project type. The .exe appears as it does in Visual Studio and when run on a display with 200% scaling, its sized properly if not a little pixelated.
But if I run the form from the class library, the sizing is off on the controls where they overlap and the form implodes on the 200% scaling display.
What I've been able to get so far is when I change the project to a forms application (.exe) and disable "XP Visual Styles" it appears the same way it does when I compile it into the .dll plug in and launch it from Inventor. Tried everything but can't seem to get the .dll version to use those visual styles.
I also found the same problem on the Revit forum, which Microsoft articles pointed to this fix:
System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(False)
But this gives a System.InvalidOperationException: 'SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application.' and since its the first item called in the Activate Sub(...) I think Inventor.exe is the first IWin32Window.
Should I not be using Winforms? or what are others using for this? I read WPF fixes a lot of these issues. I'm never opposed to learning something new.
Consultant Manufacturing Engineer | Architect of Optimization | Autodesk Developer
Solved! Go to Solution.