示例#1
0
        public static XImage FromFile(string filename)
        {
            XImage x = new XImage();

            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(filename);
                XmlNodeList colorList = doc.SelectNodes("/Image/Point/Color");
                XmlNodeList xList     = doc.SelectNodes("/Image/Point/X");
                XmlNodeList yList     = doc.SelectNodes("/Image/Point/Y");

                for (int i = 0; i < xList.Count; i++)
                {
                    IExtendFramework.Drawing.XPoint p = new IExtendFramework.Drawing.XPoint(
                        int.Parse(xList[i].InnerText),
                        int.Parse(yList[i].InnerText),
                        new Pen(Color.FromName(colorList[i].InnerText))
                        );
                    //MessageBox.Show(p.ToString());
                    x.Points.Add(p);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            return(x);
        }
示例#2
0
 public static XImage FromFile(string filename)
 {
     XImage x = new XImage();
     try
     {
         XmlDocument doc = new XmlDocument();
         doc.Load(filename);
         XmlNodeList colorList = doc.SelectNodes("/Image/Point/Color");
         XmlNodeList xList = doc.SelectNodes("/Image/Point/X");
         XmlNodeList yList = doc.SelectNodes("/Image/Point/Y");
         
         for (int i = 0; i < xList.Count; i++)
         {
             IExtendFramework.Drawing.XPoint p = new IExtendFramework.Drawing.XPoint(
                 int.Parse(xList[i].InnerText),
                 int.Parse(yList[i].InnerText),
                 new Pen(Color.FromName(colorList[i].InnerText))
                );
             //MessageBox.Show(p.ToString());
             x.Points.Add(p);
         }
     }
     catch(Exception e)
     {
         throw e;
     }
     return x;
 }