コード例 #1
0
        private void loadPictures()
        {
            XmlNodeList pictureEls = picturesXml.SelectNodes("/pictures/picture");

            foreach (XmlElement pictureEl in pictureEls)
            {
                int        id = Convert.ToInt32(pictureEl.GetAttribute("id"));
                XmlPicture p  = new XmlPicture(id);
                p.ControlMap = pictureEl.GetAttribute("control");
                pictures.Add(p);

                // add layers
                XmlNodeList layerEls = pictureEl.SelectNodes("layers/layer");
                foreach (XmlElement layerEl in layerEls)
                {
                    XmlLayer l = new XmlLayer();
                    l.Priority = Convert.ToInt32(layerEl.GetAttribute("priority"));
                    l.Width    = Convert.ToInt32(layerEl.GetAttribute("width"));
                    l.Height   = Convert.ToInt32(layerEl.GetAttribute("height"));
                    l.Left     = Convert.ToInt32(layerEl.GetAttribute("left"));
                    l.Top      = Convert.ToInt32(layerEl.GetAttribute("top"));
                    p.Layers.Add(l);
                }

                // add lines
                XmlNodeList lineEls = pictureEl.SelectNodes("control-lines/*");
                foreach (XmlElement lineEl in lineEls)
                {
                    XmlLine l = new XmlLine();
                    p.Lines.Add(l);
                    l.Priority = Convert.ToInt32(lineEl.GetAttribute("priority"));

                    if (lineEl.Name == "fill")
                    {
                        l.IsFill = true;
                    }

                    // add coordinates to line
                    XmlNodeList coordEls = lineEl.SelectNodes("coord");
                    foreach (XmlElement coordEl in coordEls)
                    {
                        XmlCoord c = new XmlCoord();
                        c.X = Convert.ToInt32(coordEl.GetAttribute("x"));
                        c.Y = Convert.ToInt32(coordEl.GetAttribute("y"));
                        l.Coordinates.Add(c);
                    }
                }
            }
        }
コード例 #2
0
        private void loadPictures()
        {
            XmlNodeList pictureEls = picturesXml.SelectNodes("/pictures/picture");
              foreach (XmlElement pictureEl in pictureEls)
              {
            int id = Convert.ToInt32(pictureEl.GetAttribute("id"));
            XmlPicture p = new XmlPicture(id);
            p.ControlMap = pictureEl.GetAttribute("control");
            pictures.Add(p);

            // add layers
            XmlNodeList layerEls = pictureEl.SelectNodes("layers/layer");
            foreach (XmlElement layerEl in layerEls)
            {
              XmlLayer l = new XmlLayer();
              l.Priority = Convert.ToInt32(layerEl.GetAttribute("priority"));
              l.Width = Convert.ToInt32(layerEl.GetAttribute("width"));
              l.Height = Convert.ToInt32(layerEl.GetAttribute("height"));
              l.Left = Convert.ToInt32(layerEl.GetAttribute("left"));
              l.Top = Convert.ToInt32(layerEl.GetAttribute("top"));
              p.Layers.Add(l);
            }

            // add lines
            XmlNodeList lineEls = pictureEl.SelectNodes("control-lines/*");
            foreach (XmlElement lineEl in lineEls)
            {
              XmlLine l = new XmlLine();
              p.Lines.Add(l);
              l.Priority = Convert.ToInt32(lineEl.GetAttribute("priority"));

              if (lineEl.Name == "fill")
            l.IsFill = true;

              // add coordinates to line
              XmlNodeList coordEls = lineEl.SelectNodes("coord");
              foreach (XmlElement coordEl in coordEls)
              {
            XmlCoord c = new XmlCoord();
            c.X = Convert.ToInt32(coordEl.GetAttribute("x"));
            c.Y = Convert.ToInt32(coordEl.GetAttribute("y"));
            l.Coordinates.Add(c);
              }
            }
              }
        }