Hello,
I start porting an application developed in v10.2.7 to v100.2 and the operation is not done without some difficulties.
There, I just discovered that the use of PictureMarkerSymbol from an image created on the fly no longer works if we use a BMP bitmap (no error but PictureMarkerSymbol does not appear on the map) but I have solved the problem using a PNG instead.
Example:
System.Drawing.Bitmap bm = new System.Drawing.Bitmap(100, 50);
System.Drawing.Graphics gra = System.Drawing.Graphics.FromImage(bm);
gra.FillRectangle(System.Drawing.Brushes.Orange, 0, 0, bm.Width / 2, bm.Height);
gra.FillRectangle(System.Drawing.Brushes.Magenta, bm.Width / 2, 0, bm.Width / 2, bm.Height);
var s = gra.MeasureString("Test", new System.Drawing.Font("Tahoma", 24, System.Drawing.FontStyle.Bold));
gra.DrawString("Test", new System.Drawing.Font("Tahoma", 24, System.Drawing.FontStyle.Bold), System.Drawing.Brushes.White, (bm.Width - s.Width) / 2, (bm.Height - s.Height) / 2);
gra.Flush();
MemoryStream ms = new MemoryStream();
bm.Save(ms, System.Drawing.Imaging.ImageFormat.Png); // ImageFormat.Bmp does not work with SDK 100.2!
PictureMarkerSymbol pms = new PictureMarkerSymbol(RuntimeImage.FromStreamAsync(ms).Result);
TestLayer.Graphics.Add(new Graphic(new MapPoint(2.3, 48.9, SpatialReferences.Wgs84), pms));
In the same way, if the creation of the bitmap was carried out using a BmpBitmapEncoder, it must be replaced by a PngBitmapEncoder (for example).
This looks like a bug, no? Or the BMP is no longer supported and in this case it would be wise to remove it from uses related to bitmaps ...
Regards,
damien.
Solved! Go to Solution.
Correct. BMP isn't supported.
Correct. BMP isn't supported.