ThinkGeo.com    |     Documentation    |     Premium Support

ScaleBarAdornmentLayer as Bitmap

Hello everyone,


I would like to know if it's possible to get the scalebar of a ScaleBarAdornmentLayer and save it as a Bitmap ?


Thanks.



Pierre-Antoine,


Thanks for your post and question, Try following code snippet:
 

ScaleBarAdornmentLayer scaleAdormentLayer = new ScaleBarAdornmentLayer();
Bitmap bitmap = new Bitmap(winformsMap1.Width,winformsMap1.Height); GdiPlusGeoCanvas geoCanvas = new GdiPlusGeoCanvas();
geoCanvas.BeginDrawing(bitmap,winformsMap1.CurrentExtent, winformsMap1.MapUnit);
scaleAdormentLayer.Open();
scaleAdormentLayer.Draw(geoCanvas, new Collection<SimpleCandidate>());
scaleAdormentLayer.Close();
 
geoCanvas.EndDrawing();
bitmap.Save(@"C:\temp\adormentLayer.bmp");

 
Any more questions please feel free to let me know.
 
Thanks.
 
Yale

Thanks for your answer.



You’re welcome, Pierre. Let us know if you have more questions.