-
I'm using bitblt for some animation in my program:
Call BitBlt(picStocksBuffer.hdc, 0, i% * iRowHeight, 600, iRowHeight, mvarRowPicture(iIndex).hdc, 0, 0, SRCCOPY)
Basically, I'm copying the picture of mvarRowPicture(iIndex) to the picture of picStocksBuffer (which are both pictureboxes).
Now when I execute this code in an .ocx usercontrol (with the pictureboxes on the usercontrol) instead of my standard form, it is slower about TEN times ! (about 0.08sec instead of 0.009 on the standard form).
Anybody has an explanation for this ?
Thanks a lot,
Felix
-
Autoredraw - Refesh problem, Do you use the exact same code for both form and control, and have autoredraw removed on both? Note Autoredraw may cause a huge message queue if you use bitblt frequently, that can't be cleaned with even thousands of doevents.
-
exact same code and autoredraw disabled everywhere... (all pictureboxes, the form and the usercontrol)
Felix
-
TO KEDAMEN:
Upps... just noticed that the SOURCE picturebox had AutoRedraw = True ...
However, when I set either
a) Set AutoRedraw = True. Then set AutoRedraw = False before BitBlt and back to True right after that
or
b) Set AutoRedraw = False. Then set AutoRedraw = true before painting the stuff and then back to false right after painting
the bitblt process goes about 3 times faster BUT I don't see the painted stuff...
Any idea? Need "picturebox.refresh" somewhere?
Thanks,
Felix
-
usercontrol.Refresh
YEah, put that after the last sequence of your blitting procedures, Why do you set autoredraw to the source objects? I mean you can make them persistant by setting their picture property to their image property. I'm not sure but you can also save time by changing clipcontrols to false on the usercontrol and the controls on it.
-
"setting their picture property to their image property" doesn't have any effect... maybe because the SOURCE picturebox is not visible (left=10000 pixels) ?
for your information: clip controls to false does not have any effect, too.
Thanks for your help!
Felix