Can't find what you're looking for?

Contact us or post in our forums and we'll help you find an answer.

Export and Save C1Maps as an Image

Background:

C1Maps for WPF does not expose a method to print or save it as an image. In other words, a user cannot export the maps view using the control’s API. This is a limitation of C1Maps.

This article shows how to workaround the above limitation by saving or exporting C1Maps as an image.

Steps to Complete:

To be able to save C1Maps as an image, Microsoft’s RenderTargetBitmap class, along with their bitmap encoders such as PngBitmapEncoder, BmpBitmapEncoder, etc., can be used as follows:

RenderTargetBitmap bitmap = new RenderTargetBitmap((int)this.Width, (int)this.Height, 96, 96, PixelFormats.Pbgra32);
bitmap.Render(c1maps);
BitmapFrame frame = BitmapFrame.Create(bitmap);
BmpBitmapEncoder encoder = new BmpBitmapEncoder();
encoder.Frames.Add(frame);
using (var stream = File.Create("../../Export_C1Maps.png"))
{
       encoder.Save(stream);
}

Get the Latest Version of C1
Download the Free Trial Now