0

我在 Windows 应用程序中遇到问题。我想更新一张图片,但它会产生异常:
GDI+ 中发生一般错误

这是我的代码:

Dim ms As New MemoryStream
PicMeter.Image.Save(ms, PicMeter.Image.RawFormat) 'here exception occurs
Dim arr As Byte() = ms.GetBuffer()
ms.Close()
4

1 回答 1

0

改变

PicMeter.Image.Save(ms, PicMeter.Image.RawFormat)

PicMeter.Image.Save(ms, ImageFormat.RawFormat)

如果这没有帮助,是否有助于创建新图像并从那里保存?如此处建议:http ://www.dreamincode.net/forums/topic/49392-pictureboximage-save-error/

Dim ms As New MemoryStream
Dim bitmp As New Bitmap(PicMeter.Image)
bitmp.Save(ms, ImageFormat.RawFormat)
Dim arr As Byte() = ms.GetBuffer()
ms.Close()
于 2013-01-23T13:17:56.200 回答