Gocomment position change on save

I have an application that save and reload in an xml format the diagram just like the sample app flocharter. The problem is that everytime that I save GoComment object in the diagram ghange its position.
the code is
–on save
writer.WriteAttributeString(“x”, XmlConvert.ToString(c.Left));
writer.WriteAttributeString(“y”, XmlConvert.ToString(c.Top));
–on read
a = item.Attributes[“x”];
if (a != null)
x = XmlConvert.ToSingle(a.Value);
a = item.Attributes[“y”];
if (a != null)
y = XmlConvert.ToSingle(a.Value);
c.Position = new PointF(x, y);
So I try this code and everything works better
–on save
writer.WriteAttributeString(“x”, XmlConvert.ToString(c.Label.Center.X));
writer.WriteAttributeString(“y”, XmlConvert.ToString(c.Label.Center.Y));
–on read
a = item.Attributes[“x”];
if (a != null)
x = XmlConvert.ToSingle(a.Value);
a = item.Attributes[“y”];
if (a != null)
y = XmlConvert.ToSingle(a.Value);
c.Label.Center = new PointF(x, y);
but it’s not perfect still sometimes the GoComment change its position
What can I do?

When loading do you set the position after setting the text of the label?

After the text
if (item.Name == “comment”) {
c.BottomRightMargin = new SizeF(0, 0);
c.TopLeftMargin = new SizeF(0, 0);
c.Label.Bordered = true;
c.Label.TextColor = Color.Navy;
c.Label.TransparentBackground = false;
c.Label.BackgroundColor = Color.FromArgb(235, 237, 243);
c.Label.AutoResizes = true;
c.Label.Wrapping = true;
c.Label.Alignment = GoObject.TopCenter;
c.Shadowed = false;
}
a = item.Attributes[“nid”];
if (a != null) {
int nid = XmlConvert.ToInt32(a.Value);
c.PartID = nid;
}
a = item.Attributes[“text”];
if (a != null)
c.Text = a.Value;
float x = 0;
float y = 0;
a = item.Attributes[“x”];
if (a != null)
x = XmlConvert.ToSingle(a.Value);
a = item.Attributes[“y”];
if (a != null)
y = XmlConvert.ToSingle(a.Value);
c.Label.Center = new PointF(x, y);
GoText t = c.Label;
a = item.Attributes[“familyname”];
if (a != null)
t.FamilyName = a.Value;
a = item.Attributes[“fontsize”];
if (a != null)
t.FontSize = XmlConvert.ToSingle(a.Value);
a = item.Attributes[“alignment”];
if (a != null)
t.Alignment = XmlConvert.ToInt32(a.Value);
a = item.Attributes[“bold”];
if (a != null)
t.Bold = (a.Value == “T”);
a = item.Attributes[“italic”];
if (a != null)
t.Italic = (a.Value == “T”);
a = item.Attributes[“strikethrough”];
if (a != null)
t.StrikeThrough = (a.Value == “T”);
a = item.Attributes[“underline”];
if (a != null)
t.Underline = (a.Value == “T”);
a = item.Attributes[“multiline”];
if (a != null)
t.Multiline = (a.Value == “T”);
a = item.Attributes[“wrapping”];
if (a != null)
t.Wrapping = (a.Value == “T”);
a = item.Attributes[“wrappingwidth”];
if (a != null)
t.WrappingWidth = XmlConvert.ToSingle(a.Value);
a = item.Attributes[“editable”];
if (a != null)
t.Editable = (a.Value == “T”);
doc.Add©;

I’m not sure, but perhaps the problem is that you are setting other properties that might change the position after setting the Position. Try setting t.Center last.
Another possibility is to set GoObject.Initializing to true, both for the GoText label as well as for the GoComment group.