Hello,
currently I have the following problem:
I implemented my own ShapeTemplate which holds additional information (like a second Box in a class called Textlabel).
When I paint a diagram, all information is displayed correctly and everything works well. After saving and loading the diagramm, the following occurs:
The ShapeTemplate is in memory (displayed correctly and everything), but the additional information holds no information anymore.
Here is my code, first the shapeTemplate:
[Serializable()]
class Shapes3682 : ShapeTemplate
{
public Color bgColor;
public static FillMode fillMode = FillMode.Winding;
public TextLabel label;
public Shapes3682(ElementTemplate[] elements, String shortName)
: base(elements, fillMode, shortName)
{
}
public void createTextLabel(Box icon, String text, int textPosition)
{
label = new TextLabel(icon, text, textPosition);
}
}
and the code for the Textlabel:
[Serializable()]
class TextLabel
{
private int iTextPosition;
private Box label;
public TextLabel(Box icon, String text, int TextPosition)
{
iTextPosition = TextPosition;
label = new Box(icon.Parent);
label.Text = text;
label.BoundingRect = new RectangleF(PointF.Empty,
icon.Parent.MeasureString(label.Text, label.Font, int.MaxValue, label.TextFormat));
label.Transparent = true;
label.Locked = true;
label.PolyTextLayout = true;
label.FitSizeToText(FitSize.KeepRatio);
icon.Parent.Add(label);
//// attach the label to the icon
RectangleF rc1 = icon.BoundingRect;
RectangleF rc2 = label.BoundingRect;
label.BoundingRect = getBoundingRect(ref rc1, ref rc2);
label.AttachTo(icon, AttachToNode.BottomCenter);
icon.SubordinateGroup.AutoDeleteItems = true;
}
}
After reloading the diagram, the label from the ShapeTemplate class is set to null
![Sad Sad](https://mindfusion.eu/yabbfiles/Templates/Forum/default/sad.gif)
.
I can't figure out why the information is not stored.
Can anyone help?
Best regards,
Alex