I am plotting a Julia Set in a panel named pnlGraph that is 601 x 601 pixels. I determine the color of each pixel in a Paint event, and plot the entire Set using the command pnlGraph.Refresh(). It takes the PC about a minute to plot all 361,201 pixels. If I see an error early in the process of the panel refreshing, I would like to be able to interrupt the refresh and do something else.
I have searched the internet and found something called DoEvents() that I am unable to use properly. Can anyone help me use DoEvents() or some other method to interrupt a panel in mid-refresh in order to save time? Thank you.
@Jimi's suggestion to use a bitmap instead of the paint event worked wonders, cutting down the time to display the image by over 80%. If I use fewer iterations, the bitmap appears almost instantaneously. That means I don't have to wait over a minute to display each image, which solves my problem.
Here's the code I developed in a separate project to create the bitmap. It's more complicated in the program I wanted it for, but this cuts out all the code that is not needed to solve my problem. I deleted the Panel and replaced it with a PictureBox called pbxFractal. That's where I placed the bitmap image. Very cool stuff.