Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Parameter Error When Using Bitmap.LockBits On Server2003

$
0
0

The following code works fine on Win7, Win8, Server2008R2, and Server2012. I can even use a 32bit bitmap as the source and the process still gives me a 1bit bitmap with no error.

System.Drawing.Imaging.BitmapData bmpData = null;
bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format1bppIndexed);

Bitmap newBitmap = new Bitmap(bmp.Width, bmp.Height, bmpData.Stride, System.Drawing.Imaging.PixelFormat.Format1bppIndexed, bmpData.Scan0);

Lockbits, however, gives an Invalid Parameter Error in Server2003.

Any ideas? 


 

Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>