-
I am using the following VB code to display the bitmap into an image control. I am taking the values of each pixel from the bitmap file , do some processing, and finally plot each individual pixel on to the image control.Take a look at it.
For x = 1 To head.width
For y = 1 To head.height
img1.PSet (x, y), RGB(r,g,b)
Next y
Next x
The problem with this code is, the user cannot do anything when the bitmap is being displayed, while control is in this loop. I want to give a cancel button to stop the display of the bitmap ie. exit from this loop. Is there a method for this ?
Alternatively, it would be nice if there is a method to speed up the display of the bitmap,like writing the pixel array directly to video memory. [ Using VB only, not using directx ] .In this way, the need for the cancel button would be eliminated.
-
a DoEvents in the middle of the loop will allow the app to yield to the O/S (and therefore the user).
You could also use the LoadPicture function which would be much faster....
Tom