Click here to Skip to main content
15,886,795 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello-

I have a program that draws a dozen thumbnail images on a full screen double buffered picturebox. It uses drawimage on the pb. Then, when the user clicks on one of the images (collision detection), that image will animate to full size. I am also moving some text, and drawing another image, etc. etc... Well, it stutters horribly. I am using a timer to change the heights, widths and locations of the images and the text.

Basically, I understand that gdi+ DrawImage() is just too slow to draw that, resize it, and draw it again (at 20fps+.) So, how do I fix it?

DirectX - REALLY complicated
OpenGl - Possibly?
Or direct bitblt'ing? Can't find much on this with VB.net. Anyone have any examples or areas to look at? I am using vb.net 2008.

Opinions? Please for the love of god help! :) I have looked everywhere for this solution.

Thanks,

Josh
Posted

Fast gdi animation:
http://www.daniweb.com/code/snippet241875.html[^]

If that doesn't help you can try to create a wpf UserControl and use System.Windows.Forms.Integration.ElementHost to integrate that with your forms application. Slide.Show[^] could be used as a starting point

If you want to use OpenGL or DirectX, take a look at mogre[^]

regards
Espen Harlinn
 
Share this answer
 
v2
Thank you for your response. Well, with a lot of debugging and head scratching, it looks like drawimage will actually suffice just fine. During the animation, I had a mouse move event that would fire on mouse move. It handled the collision detection and wasn't necessary during the animation (which really slowed everything down.) So, I just created a conditional in the mouse move, click and wheel (if timer.enabled) and it works great! In fact, I ran it at 100 fps and didn't have any stuttering what so ever.

Thanks for the info though! I have another animation in which it will come in handy!

-Josh
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900