Out of memory exception while loading images

前端 未结 4 1557
予麋鹿
予麋鹿 2021-01-14 06:23

I am using the following piece of code to load images as thumbnails to a FlowLayoutPanel control. Unfortunately i get an OutOfMemory exception.

As you already guess

4条回答
  •  走了就别回头了
    2021-01-14 06:38

    You can solve this in a few steps:

    • to get free from the File-dependency, you have to copy the images. By really drawing it to a new Bitmap, you can't just copy it.
    • since you want thumbnails, and your source-bitmaps are rather large, combine this with shrinking the images.

提交回复
热议问题