After running the Upgrade tool from Visual Studio 2022 my code for loading a usercontrol to a new toolpalette is failing.
I get the error The type or namespace name 'PaletteSet' could not be found (are you missing a using directive or an assembly reference?)
Before the upgrade the code was working fine and i had no error or missing reference.
According the developer docs, toolpalettes are part of Autodesk.AutoCAD.Windows
When i add Using Autodesk.AutoCAD.Windows it gets greyed out and my code keeps the error.
Below a bare minimum project trying to load a palette. What am i missing?
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Windows;
using System.Drawing;
namespace RN_ACADTOOLS
{
public class MainClass
{
[CommandMethod("showmypalette")]
public void ShowMyPalette()
{
createPallete();
}
public void createPallete()
{
string palleteName = "My-Palette";
PaletteSet myPaletteSet = new PaletteSet(palleteName, new Guid("{E405F622-A37A-420C-BC18-16F0B1935A4A}"));
myPaletteSet.Style = PaletteSetStyles.ShowAutoHideButton |
PaletteSetStyles.ShowCloseButton |
PaletteSetStyles.Snappable;
myPaletteSet.Opacity = 100;
myPaletteSet.Size = new Size(500, 400);
myPaletteSet.MinimumSize = new Size(250, 200);
myPaletteSet.Add(palleteName, new UCmain());
myPaletteSet.Visible = true;
}
}
}
Solved! Go to Solution.
Solved by norman.yuan. Go to Solution.
Have you added reference to acmgd.dll? Autodesk.AutoCAD.Windows.PaletteSet class is contained in acmdg.dll assembly.
Norman Yuan
Can't find what you're looking for? Ask the community or share your knowledge.