I have a 256 color bitmap image that's 14 X 14 pixels in size. I used the following code to write a number between 1 and 99, and save it, to create 99 versions of the bitmap. The images get created and look fine. But when I call the following line, I get an exception. It works fine for the stock image file (blank dot) which I use as a base. But when any image I created is used, it throws an exception.
symbol = mpControl.ActiveMap.Symbols.Add( fileName );
Exception: "The format of the bitmap is not supported. Bitmaps must be compressed and use 1, 4, 8 or 24 bit color."
What can I do differently to so that the 99 images I create will appear no different from the stock image?
for ( int number=1; number<=99; number++ )
string breadCrumbFileName = Preferences.ImagesDir + colorName + number.ToString() + ".bmp";
if ( handles.Utils.FileExists( fileName ) )
Image outputImg = Image.FromFile(fileName);
Bitmap outputBmp = new Bitmap(outputImg);
Graphics g = Graphics.FromImage(outputBmp);
// do something with "g"
Font arial = new Font( "Arial", 7 );
Font arialBold = new Font( arial, FontStyle.Bold );
if ( number < 10 )
g.DrawString(number.ToString(), arialBold, Brushes.White, new PointF(3,1));
g.DrawString(number.ToString(), arialBold, Brushes.White, new PointF(0,1));
// release the graphics
// save the changes in the original fileName
outputBmp.Save( breadCrumbFileName, System.Drawing.Imaging.ImageFormat.Bmp);