int halfWidth = (App.CroppedImage.PixelWidth / 9);
int halfHeight =(App.CroppedImage.PixelHeight / 9);
for (int row = 0; row < 9; row++)
for (int col = 0; col < 9; col++)
{
WriteableBitmap wr = App.CroppedImage.Crop(col * halfHeight, row * halfWidth, halfWidth, halfHeight);
MediaLibrary MLibrary = new MediaLibrary();
IsolatedStorageFileStream IsoStoreFileStreams = myStore.CreateFile("test"+row+col+".jpg");
Extensions.SaveJpeg(wr, IsoStoreFileStreams, 100, 100, 0, 85);
IsoStoreFileStreams.Close();
IsoStoreFileStreams = myStore.OpenFile("test"+ row + col +".jpg", FileMode.Open, FileAccess.Read);
//Add the JPEG file to the photos library on the device.
MediaLibrary libraryy = new MediaLibrary();
Picture picc = library.SavePicture("Saved"+row+col+".jpg", IsoStoreFileStreams);
IsoStoreFileStreams.Close();
}
此函数中的异常
Extensions.SaveJpeg(wr, IsoStoreFileStreams, 100, 100, 0, 85);
消息是
Microsoft.Phone.ni.dll中出现“System.ArgumentException”类型的异常,但未在用户代码中处理
答案 0 :(得分:0)
堆 对不起,我发现我的错误是` WriteableBitmap wr = App.CroppedImage.Crop(col * halfWidth,row * halfHeight,halfWidth,halfHeight);
代替
WriteableBitmap wr = App.CroppedImage.Crop(col * halfHeight,row * halfWidth,halfWidth,halfHeight);
`