Crainiate Community

Support and discussion for users of Crainiate component software products
Welcome to Crainiate Community Sign in | Join | Help
in Search

Extracting the selected part of a model

Last post 07-31-2007 8:10 AM by James Westgate. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-31-2007 12:42 AM

    Extracting the selected part of a model

    In the prototype im working i need to select a couple of shapes and allow that selection to be made available in my toolbox. The ideia is for the users to reuse entities created in future projects, simply by dragging them from the toolbox(witch is a custom toolbox, not the one shipped with your package). What's the best way to achieve this? For what ive seen i was thinking in using something like your "copy" command and then paste the elements into an invisible diagram so it can se serialized into FS. What i dont know is how can i drop the shapes in the serialized model into a new model.

     Do you have an easier way to do this? If so could you give me some pointers?

     Thanks

    • 83.132.216.122
  • 07-31-2007 8:10 AM In reply to

    Re: Extracting the selected part of a model

    Shapes are fully serializable by themselves, this is how the cut and paste system and the undo/redo system works. You can use normal .net serialization using a binary, soap or xml formatter to copy these items to eg a stream (say with a right click context menu option), then deserialize them as normal into your toolbox. You can also save the serialized data to disk/database to create a collection, perhaps by simply serializing an entire Shapes collection.

    You will also find that the Palette control saves and loads from disk, supports drag drop etc becuase it inherits from Diagram. You can change the appearance and behaviour by overrding the control, and by changing the PaletteRender class.

    If you need help with either of these items, please let me know.

    Filed under:
    • 86.155.94.155
Page 1 of 1 (2 items)