问题描述
在C#程序调试中出现Parameterisnotvalid,指向ImageLockMode.ReadWrite,哪个位高手指点一下,下面是具体程序:publicstaticboolGetLowWidth(Bitmapb,stringstrPath){//GDI+stillliestous-thereturnformatisBGR,NOTRGB.BitmapSubstractedBitmap=(Bitmap)Bitmap.FromFile(strPath,false);BitmapDatabmData=b.LockBits(newRectangle(0,0,b.Width,b.Height),ImageLockMode.ReadWrite,PixelFormat.Format24bppRgb);BitmapDataSubbmData=SubstractedBitmap.LockBits(newRectangle(0,0,700,500),ImageLockMode.ReadWrite,PixelFormat.Format1bppIndexed);unsafe{intnWidth=b.Width;for(inty=0;y<b.Height;y++){for(intx=0;x<nWidth;x++){if(GetIndexPixel(x,y,bmData))continue;if(!GetIndexPixel(x,y,SubbmData)){SetIndexedPixel(x,y,bmData,true);Changed(newBitmapFilter(),EventArgs.Empty);}}}}b.UnlockBits(bmData);SubstractedBitmap.UnlockBits(SubbmData);