We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

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 09:14 AM

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 09:49 AM

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.
Live Chat Icon For mobile
Up arrow icon