Hello,

I have a certain algorithm which fills a Drawing.Bitmap according to a file on the computer. This bitmap is set as the background image of a picturebox. The user can select a different file, at which point I need to update the contents of the bitmap.

This is quite easy (doing a pcb.Invalidate() after the updating), but the problem is that the bitmap can vary in size. I basically need to resize the bitmap every time the user selects a different file.

The bitmap is a public variable. What I tried was disposing the bitmap and then do a "myBMP = New Bitmap(newX, newY)" to update the size. I get a "ArgumentException was unhandled" error, but for some reason it does not tell me which line it happened on.

So, I basically need to know how to resize a bitmap on runtime. Also, the algorithm takes too long to add it to the Paint event of the picturebox. I really need to set it as an image so I have to draw it only once.