GDI+ exception saving a Bitmap to a MemoryStream

后端 未结 2 1004
终归单人心
终归单人心 2021-01-06 14:36

I have a problem in a Windows Forms application with Bitmap.Save failing when I save to a MemoryStream. The problem only seems to occur intermittently on one machine (so fa

2条回答
  •  情深已故
    2021-01-06 15:06

    The MSDN docs for that Bitmap constructor leave no doubt whatsoever:

    Remarks The caller is responsible for allocating and freeing the block of memory specified by the scan0 parameter, however, the memory should not be released until the related Bitmap is released.

提交回复
热议问题