Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Saving Diagram with Custom Shapes (Read 3088 times)
mws0717
YaBB Newbies
*
Offline



Posts: 13
Joined: Feb 17th, 2009
Saving Diagram with Custom Shapes
Feb 18th, 2009 at 12:55pm
Print Post  
I'm trying to evaluate NetDiagram for a project. I am using the Flowchart demo to start. I used the Shape Designer tool to create about a dozen shapes. I drag them onto the diagram and save. When I load the diagram, all of my custom images are replaced with rounded rectangles. I changed the save code from diagramView.Diagram.SaveToFile to diagramView.Diagram.SaveToXml, recreated my diagram with custom shapes and saved. When I look at the resulting XML file, sure enough, all of the shape IDs are "RoundRect". What am I doing wrong?

Thanks for your help.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Saving Diagram with Custom Shapes
Reply #1 - Feb 18th, 2009 at 1:22pm
Print Post  
If using JavaApplet mode, set the ShapeLibraryLocation property to a URL where the applet can download the shape definitions from. Both for JavaApplet and ImageMap mode, add a ShapeLibrary.LoadFrom() call to the page_Load handler, or add the code that defines the custom shapes there, inside an if (Shape.FromId(...) == null) statement. The latter is required since custom shapes definitions are not saved in the viewstate, and might be lost once IIS unloads the Diagramming.dll assembly after some period if inactivity. Another possibility is to load / define the shapes upon application startup in Globals.asax.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
mws0717
YaBB Newbies
*
Offline



Posts: 13
Joined: Feb 17th, 2009
Re: Saving Diagram with Custom Shapes
Reply #2 - Feb 18th, 2009 at 2:19pm
Print Post  
Adding the ShapeLibrary.LoadFrom() call to Page_Load appears to have done the trick. It also appears that I have to use that call in addition to setting the ShapeLibraryLocation.

Thanks!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint