Jump to content
Software FX Community

Custom Annotation toolbar not persisted during import

User (Legacy)

Recommended Posts

I have a annotation toolbar which has been modified with a custom command.


//Customize the annotation toolbar

int pasteImageCommandID2 = (int)CommandID.Last + 2000;

pasteImageCommand2 = annotx.Commands.AddCommand(pasteImageCommandID2);

pasteImageCommand2.Text = "Paste";

pasteImageCommand2.Picture = 19;

int idx = 0;


annotx.ToolBarObj[idx] = pasteImageCommandID2;


If I export extensions and then import them again, I have several problems.

First, the annotation toolbar loads but my custom command is missing. This

requires me to add my customizations back in to the toolbar which is not

really a big deal.


chart1.FileMask = FileMask.Extensions;

chart1.Export(FileFormat.XML, filePath);


//Then Import some time after

chart1.Import(FileFormat.XML, filePath);


The second problem is the Toolbars menu command is missing from the

Background context menu even though the toolbar is displayed.

Instead of seeing Toolbars->Toolbar and Toolbars->Annotation Toolbar, all I

see is the Toolbar command and no command for the Annotation toolbar.

I tried saving the subcommands before the import and restoring them after,

but the restored Annotation Toolbar command checkmark is out of sync with

the displayed toolbar. Removing the checkmark from the Annotation Toolbar

submenu actually displays a second toolbar.

I also tried using FileMask.All for the export but with similar results.

Is there any way to restore the Toolbars menu and the subitems to their

correct state?

It would also be nice to be able to export the annotation objects

independently of the toolbar. This way, I wouldn't need to mess with the

toolbar at all when all I really want is the annotation objects.

Link to comment
Share on other sites

Actually, all I really want to persists are the annotation objects, so it

seems like chart1.FileMask = FileMask.Extensions is correct. The problem is

that even though I'm importing only extensions, my annotation toolbar

changes and I can't get it back to its original state. I tried or-ing in the

FileMask.Tools option to see if I could save and import the annotation

toolbar along with the extensions but the customization is gone on import.

It is not clear from the documentation whether the FileMask.Tools applies to

the standard toolbar, the annotation toolbar, or both. Does the annotation

toolbar (As opposed to the standard toolbar) belong to FileMask.Extensions

or to FileMask.Tools? Perhaps you could clarify.

Link to comment
Share on other sites

It is both.

You need both Tools and Extensions to save customizations to the annotation


I tested the following:


annotX.Commands[1].Text = "Custom Command";


annotX.ToolBarObj[0] = 1;

chart1.FileMask = FileMask.Tools | FileMask.Extensions;


Later, I imported this file into a brand new chart and I can see the custom


Are you doing the same ? if you are I'm going to need a repro case.



Software FX

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...