Bitmap Palette Error after migrating to VS2008

  • Thread starter Thread starter jj
  • Start date Start date
J

jj

The following creates a copy of an image. It worked fine in Visual Studio
2005, but after installing Visual Studio 2008 then opening the solution as a
..net 2.0 project, I get an error on the 'bmpOut.Palette = imageFile.Palette'
line (see below).

Anyone come across this or suggest a reason for the error?


private static System.Drawing.Image CreateImageFile(System.Drawing.Image
imageFile, int width, int height)
{
System.Drawing.Bitmap bmpOut;
ImageFormat Format = imageFile.RawFormat;
bmpOut = new Bitmap(width, height,
PixelFormat.Format64bppPArgb);
bmpOut.SetResolution(imageFile.HorizontalResolution,
imageFile.VerticalResolution);
/ /***** bmpOut.Palette = imageFile.Palette;***** CAUSES ERROR
'INVALID PARAMETER//
Graphics g = Graphics.FromImage(bmpOut);
g.InterpolationMode =
System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.SmoothingMode =
System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.PixelOffsetMode =
System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
g.CompositingQuality =
System.Drawing.Drawing2D.CompositingQuality.HighQuality;

g.FillRectangle(Brushes.White, 0, 0, width, height);
g.DrawImage(imageFile, 0, 0, width, height);
imageFile.Dispose();
g.Dispose();
return bmpOut;
}
 
Weird. Thought someone might know the answer to this one. I can't work out
why this no longer works in VS2008
 
Back
Top