Hi,
I'm trying to combine multiple fairly large png files (7000 by 7000 pixels) that have transparency (32bpp) using GDI+. In the OnPaint event of a usercontrol I draw the images on top of each other like this:
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Try
If Not mImageList Is Nothing Then
e.Graphics.TranslateTransform(AutoScrollPosition.X, AutoScrollPosition.Y)
e.Graphics.MultiplyTransform(Transform)
For i As Integer = 0 To mImageList.Count - 1
e.Graphics.DrawImage(CType(mImageList.Item(i), Image), 0, 0)
Next
End If
Catch ex As Exception
Windows.Forms.MessageBox.Show(ex.ToString)
End Try
End Sub
mImageList is an ArrayList of Image-objects in which I import the various png files. It works with two png files of the mentioned dimension. But adding another one causes an OutOfMemory Exception. Sometimes already where the png's are added to the ArrayList or on the line where the image is drawn in the above procedure.
Is there a way I can get this to work? Is it really a matter of not enough memory? I've got gigabytes of ram free. Is there another way to get around this?
JosP