Skip to content

Zoom a wmf image file?

Bahar Jalali

Asked Dec 23, 2011, 9:54 PM EST1 answer
Share
LinkedInX
hi

i have a wmf image file that is a map
i want to zoom on it but when i use common ways for zooming on the picture, it don't work for wmf file but work for another formats of a picture fine!

how can i zoom a wmf image file?
please suggest me your solutions

thanks in advance

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    here is my code

     public Image PictureBoxZoom(Image img, Size size)
            {
                //Bitmap bm = new Bitmap(img, Convert.ToInt32(img.Width * size.Width), Convert.ToInt32(img.Height * size.Height));
                Metafile imgOriginal = new Metafile("pic/Iran_political.wmf");
                Graphics grap = Graphics.FromImage(imgOriginal);
                grap.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                return imgOriginal;
            }

            private void zoomSlider_Scroll(object sender, EventArgs e)
            {
                if (zoomSlider.Value > 0)
                {
                    pictureBox1.Image = null;
                    pictureBox1.Image = PictureBoxZoom(imgOriginal, new Size(zoomSlider.Value, zoomSlider.Value));
                }
            }

    on the bold line, it has an error : out of memory!

    why?
    how can i solve it?
    my image size is about 5000 * 6000 , it's a map (wmf format picture).
    0