Custom Properties on General Shapes

Oct 1, 2014 at 5:34 PM
Hi, amazing project! I haven't dug into it too deeply yet, but just wondering if there is a guide to adding custom properties on the general shapes and connector types so they show up in the property editor panel. I could hack at it, but wanted to do it the 'right' way. thx.
Coordinator
Oct 6, 2014 at 2:18 PM
If you want to add custom properties to shapes, you have to derive your own shapes.
This way, you can add any propertiy of any type you like and all will show in the property editor (which is a standard .NET property grid).

See "Programmer Tasks > Developing a New Shape Class" in the documentation.
In order to persist the data of your custom properties, you have to override the following methods:
GetPropertyDefinitions(int version) (this is a static method)
LoadFieldsCore
SaveFieldsCore
See documentation "Programmer Tasks > Developing a New Shape Class > Adding Persistency Support > Implementing the Load Method" or the base classes implementations for details.
May 26, 2016 at 1:32 PM
Hi again,

i dont want new draw shape for custom properties no way this?
example: i want change RoundedBox properties?
Coordinator
May 31, 2016 at 9:22 AM
  • In case you want to hide properties from the end-user (in the PropertyEditor) , you can use Permission sets.
  • In case you just want to store some infos in your shape, you could use the Shape.Data (string) property
    In these cases, there is no need to derive your own shape.
If you have to add 'real' properties, you can use one of the "...Base" classes defined in Dataweb.NShape.dll.
In your case (RoundedBox), there is no base class with rounded corners, so you can derive your shape from RoundedBox in GeneralShapes (which means you have to ship your application with Dataweb.GeneralShapes.dll) or you copy and modify the code of RoundedRectangle.