Zoom in SvgPictureBox

Topics: SVG
May 6, 2011 at 12:25 PM

How do you zoom in and out using the svgpicturebox control?



May 6, 2011 at 12:56 PM

Hello Frank,

Sorry, this feature is not implemented. I never thought about interest in the GDI
renderer, but concentrated on the WPF renderer, since I needed that for my work.

I trying to release the version 1.0 and then redesign most parts of the GDI, providing it
with testing applications, controls and viewers. This will address this issue.

Best regards,

May 8, 2011 at 2:20 AM
Edited May 8, 2011 at 2:30 AM

Here's a quick and dirty way to get zoom features with svgpicturebox:

myXml is the XmlDocument

private void TheZoomer(float Zint)  


            String LocalScale = "";
            if (myXml.LastChild.Attributes["transform"] != null)


               LocalScale = myXml.LastChild.Attributes["transform"].Value;  




             XmlAttribute scaxml = myXml.CreateAttribute("transform");  

             scaxml.Value = "scale(1.0)";    


             LocalScale = "scale(1.0)";  


      string parsIt = LocalScale.Replace("scale(", "").Replace(")", "");    

     string[] parts = parsIt.Split(',');  

   float[] ops = new float[parts.Length];

            for (int i = 0; i < parts.Length; i++) 


  ops[i] = float.Parse(parts[i]) + Zint;

if(ops[i] >0 )

                 LocalScale = ops[i].ToString() + ",";


            LocalScale = LocalScale.Substring(0, LocalScale.Length - 1);

            LocalScale = "scale(" + LocalScale + ")";

            myXml.LastChild.Attributes["transform"].Value = LocalScale;



May 11, 2011 at 11:20 PM
Edited May 11, 2011 at 11:23 PM

Hello Frank,

Sorry for the late reply, thanks for the codes.

I am looking at the codes right now. Just some few things...

1. On the last line, is the SVGPicture class the same as SvgPictureBox or your customized implementions?
2. How is this used in your codes? In particular, how are you maintaining the zoom factor?

If possible, please can you summit an updated version of the SvgPictureBox, which works with this code?

Best regards,