Esempio n. 1
0
        public void SetUp()
        {
            SvgWindow   wnd = new SvgWindow(100, 100, new GdiRenderer());
            SvgDocument doc = wnd.CreateEmptySvgDocument();

            doc.LoadXml("<svg xmlns='" + SvgDocument.SvgNamespace + "'><rect /></svg>");
            elm = (SvgStyleableElement)doc.SelectSingleNode("//*[local-name()='rect']");
        }
Esempio n. 2
0
        public void LoadXml(string xml)
        {
#if RELEASE
            try
            {
#endif
            // Worry about clearing the graphics nodes map...
            renderer.ClearMap();
            System.GC.Collect();
            System.Threading.Thread.Sleep(1);

            if (xml != null && xml.Length > 0)
            {
                if (xml != null && xml.Length > 0)
                {
                    SvgDocument doc = window.CreateEmptySvgDocument();
                    doc.LoadXml(xml);
                    window.Document = doc;
                    SetupStyleSheets();
                    //JR
                    if (autoSize)
                    {
                        ISvgRect r = window.Document.RootElement.GetBBox();
                        this.Width  = (int)r.Width;
                        this.Height = (int)r.Height;
                    }
                    Render();
                    loaded = true;
                }
            }
#if RELEASE
        }

        catch (Exception e)
        {
            MessageBox.Show("An error occured while loading the document.\n" + e.Message);
        }
#endif
        }