I am saving specific properties from every GoObject to XML and got a show stopper to save the Brush for a GoPolygon,GoRectangle .....
Any Advice.....
Private Sub WriteXMLGoPolygon(ByRef wr As XmlTextWriter, ByVal GoObj As GoObject)
Dim s As GoPolygon = CType(GoObj, GoPolygon)
Dim i As Integer, sX As String, sY As String
wr.WriteStartElement("polygon")
sX = "" : sY = ""
For i = 0 To s.PointsCount - 1
Dim ss As PointF = s.GetPoint(i)
sX = sX + ss.X.ToString & ":"
sY = sY + ss.Y.ToString & ":"
Next
wr.WriteAttributeString("x", sX)
wr.WriteAttributeString("y", sY)
wr.WriteAttributeString("layerid", s.Layer.Identifier)
wr.WriteAttributeString("penwidth", XmlConvert.ToString(s.Pen.Width))
wr.WriteAttributeString("color", XmlConvert.ToString(s.Pen.Color.ToArgb))
' wr.WriteAttributeString("brush", ??????
For HatchBrushes, you could save the HatchStyle, ForegroundColor, and BackgroundColor.
For TextureBrushes, you need to save or refer to the image somehow -- depends on your application.
For LinearGradientBrushes and PathGradientBrushes, this gets more complicated, but almost always your particular GoShape subclass will be generating such brushes dynamically based on the size of the shape, so perhaps you just need to save some Colors and Singles which are the real parameters for (i.e. properties of) that shape class.
To summarize: how much you need to save depends on your application's use of brushes.
You need to see if the Brush is not Nothing and, if not, whether it is a SolidBrush. If so, you can cast it (CType) it to a SolidBrush and then get its Color.
Same goes for the other Brush classes, if you use them.