public string DrawDiagramSvg() { SvgNet.SvgGdi.SvgGraphics ig; ig = new SvgNet.SvgGdi.SvgGraphics(); ig.Clear(Color.FromArgb(255, 255, 255, 255)); ig.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; ig.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; dlginstance.Draw(ig, 1.0f, -1, -1, new Point(-(dlginstance.VisibleRect.Location.X - 1), -(dlginstance.VisibleRect.Location.Y - 1)) , DrawClips, dlginstance.VisibleRect.Width); //string s = ig.WriteSVGString(dlginstance.VisibleRect.Width, dlginstance.VisibleRect.Height); string s = ig.WriteSVGString(); int IncIdx = s.IndexOf("SvgGdi_output"); if (IncIdx > 0) { string marker = "2000/svg\""; IncIdx = s.IndexOf(marker, IncIdx); if (IncIdx > 0) { s = s.Insert(IncIdx + marker.Length, string.Format(" width=\"{0}px\" height=\"{1}px\" ", dlginstance.VisibleRect.Width + 1, dlginstance.VisibleRect.Height + 1)); } } return(s); }
private void cbWhat_SelectedIndexChanged(object sender, System.EventArgs e) { SvgGraphics ig; ig = new SvgGraphics(); Render(ig); string s = ig.WriteSVGString(); tbSVG.Text = s; StreamWriter tw = new StreamWriter("c:\\temp\\foo.svg", false); tw.Write(s); tw.Close(); svgCtl.SRC = "c:\\temp\\foo.svg"; this.panel1.Invalidate(); }
public SvgGraphics2() { _svgGraphics = new SvgNet.SvgGdi.SvgGraphics(); }
private void cbWhat_SelectedIndexChanged(object sender, System.EventArgs e) { SvgGraphics ig; ig = new SvgGraphics(); Render(ig); string s = ig.WriteSVGString(); tbSVG.Text = s; string tempFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "foo.svg"); StreamWriter tw = new StreamWriter(tempFile, false); tw.Write(s); tw.Close(); svgCtl.Navigate(new Uri(tempFile)); svgCtl.Refresh(WebBrowserRefreshOption.Completely); this.panel1.Invalidate(); }