S
SteveT
I have a structure that contains both 32x32 and 16x16 icons plus some text.
I want to write all this to an XML file so that I can recover the icons later
in an application. Can someone tell me how to properly serialize the
System.Drawing.Icon structure to an XML file?
The following code doesn't write the icon information to the xml file.
private void CreateXmlFile(string filename)
{
string fullPath = String.Format(@"{0}", filename);
XmlWriter xw = null;
try
{
XmlSerializer xSer = new XmlSerializer(typeof(AppIconList));
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.ConformanceLevel = ConformanceLevel.Auto;
xw = XmlWriter.Create(fullPath, settings);
xSer.Serialize(xw, this.List);
}
catch (Exception e)
{
System.Windows.MessageBox.Show(e.Message);
}
finally
{
// Ensure the file is closed.
if (xw != null)
xw.Close();
}
}
I want to write all this to an XML file so that I can recover the icons later
in an application. Can someone tell me how to properly serialize the
System.Drawing.Icon structure to an XML file?
The following code doesn't write the icon information to the xml file.
private void CreateXmlFile(string filename)
{
string fullPath = String.Format(@"{0}", filename);
XmlWriter xw = null;
try
{
XmlSerializer xSer = new XmlSerializer(typeof(AppIconList));
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.ConformanceLevel = ConformanceLevel.Auto;
xw = XmlWriter.Create(fullPath, settings);
xSer.Serialize(xw, this.List);
}
catch (Exception e)
{
System.Windows.MessageBox.Show(e.Message);
}
finally
{
// Ensure the file is closed.
if (xw != null)
xw.Close();
}
}