예제 #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
 void OpenToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OpenFileDialog ofd = new OpenFileDialog();
     ofd.Filter = "XImages|*.ximg|All Files|*.*";
     if (ofd.ShowDialog() == DialogResult.OK)
     {
         Image = XImage.FromFile(ofd.FileName);
         // repaint
         this.Invalidate();
         this.xImageControl1.Invalidate();
     }
 }
예제 #3
0
 public static XImage FromPoints(List<IExtendFramework.Drawing.XPoint> points)
 {
     XImage i = new XImage();
     i.Points = new IExtendFramework.Collections.Generic.LightCollection<XPoint>(points.ToArray());
     return i;
 }
예제 #4
0
 void NEwToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Image = new XImage();
     filename = "";
     xImageControl1.LoadImage(Image);
 }