GradientPanel BackgroundColor

I''m attempting to use the BackgroundColor.WriteXML to write out the current setting of a panel but I''m getting nothing - stream length of zero. Here''s a code sample : MemoryStream strOutput = new MemoryStream(); System.Xml.XmlTextWriter writer = new XmlTextWriter(strOutput, null); this.BackgroundColor = new BrushInfo(Color.Purple); this.brush.WriteXml(writer); What am I missing??

2 Replies

LS Lori S. Pearsall July 6, 2004 02:14 PM UTC

Let''s try this again - code sample : MemoryStream strOutput = new MemoryStream(); System.Xml.XmlTextWriter writer = new XmlTextWriter(strOutput, null); this.BackgroundColor = new BrushInfo(Color.Purple); this.BackgroundColor.WriteXml(writer); What am I missing??


AD Administrator Syncfusion Team July 7, 2004 02:49 PM UTC

Hi Lori You could use the XmlSerializer Class to do what you are seeking. Here is a code snippet which saves the information in a file called bginfo.xml: string xmlFilename = "bginfo.xml"; XmlSerializer serializer = new XmlSerializer(typeof(Syncfusion.Drawing.BrushInfo)); Stream fs = new FileStream(xmlFilename, FileMode.Create); System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(fs, System.Text.Encoding.Default); serializer.Serialize(fs,this.gradientPanel1.BackgroundColor); writer.Close(); Regards, Arun

Loader.
Up arrow icon