Hi,
What specific properties of GoShape and GoImage do you want to save?
GraphML in Orgcharter does do this, perhaps not for all the properties you want, but it's easy to add more.
I'm not sure if you want the F4 properties dialog to be a part of your end-user interface, but I would recommend against it. There are certainly properties there that let the user change items like Pen Color. But at the same time, you probably don't want users changing Behavior items like Deletable or Movable.
(My personal opinion is the Properties dialog is a UI only a programmer could love, and it shouldn't be shown to an end-user.)
If you provide a more limited UI for node customization, you make the XML problem easier. For example, if you allow them to only set SolidBrush colors and not gradients. If you make that restriction, then the WriteShapeData code in OrgCharter is fine. If you allow bold fonts, for example, you have to extend the xml reader/writer...
To add support for a bold fonts, you would first add to GenerateDefinitions…
WriteKeyDefinition("fontsize", "all", "float");
<font color="#ff0000"> WriteKeyDefinition("fontbold", "all", "bool"); // new line</font>
then, make the changes to the Text Reader/Writer
// read and write data for GoText
public virtual void WriteTextData(GoText lab) {
if (lab == null) return;
Color c = lab.TextColor;
Color bc = lab.BackgroundColor;
String fn = lab.FamilyName;
float fs = lab.FontSize;
bool fb = lab.Bold;
if (lab.Text.Length > 0)
WriteData("text", lab.Text);
if (c != Color.Black)
WriteData("textcolor", WriteAttrVal(null, c));
if (bc != Color.White)
WriteData("backcolor", WriteAttrVal(null, bc));
if (fn != GoText.DefaultFontFamilyName)
WriteData("fontname", fn);
if (fs != GoText.DefaultFontSize)
WriteData("fontsize", WriteAttrVal(null, fs));
<font color="#ff0000">if (fb)
WriteData("fontbold", WriteAttrVal(null, fb));
</font>
}
public virtual void ReadTextData(GoText lab, String attr, String val) {
if (lab == null) return;
if (attr == "text") {
lab.Text = val;
} else if (attr == "textcolor") {
lab.TextColor = ColorFromString(val, Color.Black);
} else if (attr == "backcolor") {
lab.BackgroundColor = ColorFromString(val, Color.White);
} else if (attr == "fontname") {
lab.FamilyName = val;
} else if (attr == "fontsize") {
lab.FontSize = SingleFromString(val, GoText.DefaultFontSize);
} <font color="#ff0000">else if (attr == "fontbold") {
lab.Bold = BooleanFromString(val, false);
</font> }
}
// use this in overrides of ReadData to decide to call ReadTextData
public virtual bool IsTextData(String attr) {
return (attr == "text" || attr == "textcolor" || attr == "backcolor" || attr == "fontname" || attr == "fontsize"<font color="#ff0000"> || attr == "fontbold"</font>);
}
I hope this helps.