ThinkGeo.com    |     Documentation    |     Premium Support

winformsMap1.DrawToBitmap Shifts and Clips Map

When I save an image of the map, the saved jpg image is offset and clipped. Here is the simple code:

 using (var bm = new Bitmap(winformsMap1.Width, winformsMap1.Height))
  {
         winformsMap1.DrawToBitmap(bm, winformsMap1.Bounds);
         bm.Save(sfd.FileName, System.Drawing.Imaging.ImageFormat.Jpeg);
   }

I’ve also tried winformsMap1.Bounds.Width. Attached are the image of the form and the associate clipped image.


Hi Michael,

Please try this code:

winformsMap1.DrawToBitmap(bm, winformsMap1.ClientRectangle);

instead of yours:

winformsMap1.DrawToBitmap(bm, winformsMap1.Bounds);

Please let me know whether it works for your application.

Regards,

Ethan

Awesome… that worked perfect… Thanks!

Hi Michael,

I am glad to hear that’s helpful.

Regards,

Ethan