Hello Cristianf,
To remove or change the icon in a command from NDiagramCommandBarsManager you will need to override CreateUICommand method in manager’s commander class (NDiagramCommander)
Here is an example which you can use:
public class MyNDiagramCommander : NDiagramCommander
{
public override object CreateUICommand(NDiagramCommand command)
{
NCommandContext context = new NCommandContext();
// range and id
context.RangeID = command.RangeId;
context.Properties.ID = command.Id;
// text and tooltip
context.Properties.Text = command.Text;
context.TooltipText = command.TooltipText;
// shortcut
if (command.Shortcut != null)
{
context.Properties.Shortcut = command.Shortcut;
}
// image
NCustomImageList imageList;
int imageIndex;
if (command.GetImageInfo(out imageList, out imageIndex))
{
//Here we make a check for the command's type (in this case one that format text to be bold) so we can omit the drawing of the icon.
//However, you can put any other logic here.
if (command is NMakeBoldTextCommand)
{
}
else
{
context.Properties.ImageInfo.Image = imageList.GetImage(imageIndex);
}
}
return context;
}
}
Then you need to set an instance of the new commander to the command bars manager and call recreate method:
MyNDiagramCommander commander = new MyNDiagramCommander();
m_DiagramCommandBarManager.Commander = commander;
m_DiagramCommandBarManager.Recreate();
Hope this helps.