Esempio n. 1
0
        void InitializeDocument()
        {
            XmlDocument dom = new XmlDocument();

            dom.XmlResolver = null;
            dom.CreateDocumentFragment();

            // declaration
            XmlDeclaration declaration = dom.CreateXmlDeclaration("1.0", "UTF-8", "no");

            dom.AppendChild(declaration);

            // root
            XmlElement svg = dom.CreateElement("svg");

            dom.AppendChild(svg);
            svg.SetAttribute("xmlns", "http://www.w3.org/2000/svg");
            svg.SetAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
            svg.SetAttribute("version", Version);
            //svg.SetAttribute("creator", ProductInfo.Title);
            //svg.SetAttribute("creator_version", ProductInfo.Version);
            svg.SetAttribute("width", Width.ToString());
            svg.SetAttribute("height", Height.ToString());
            svg.SetAttribute("viewBox", string.Format("{0} {1} {2} {3}", 0, 0, Width, Height));

            // comment
            var comment = dom.CreateComment("Create by Blumind, you can download it free from http://blumind.org ");

            svg.AppendChild(comment);

            // title
            var titleElement = dom.CreateElement("title");

            titleElement.InnerText = Title;
            svg.AppendChild(titleElement);

            // defs
            Defines = dom.CreateElement("defs");
            svg.AppendChild(Defines);

            // style
            Styles = dom.CreateElement("style");
            Defines.AppendChild(Styles);

            // canvas
            Canvas = dom.CreateElement("g");
            Canvas.SetAttribute("id", "canvas");
            svg.AppendChild(Canvas);

            Dom = dom;
        }