By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,904 Members | 1,646 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,904 IT Pros & Developers. It's quick & easy.

Zooming and panning with GDI+ is first slow, but then fast?

P: 1
I am currently creating a little photo application. In this application the user is able to zoom in the image and after zooming panning around inside the zoomed image with the mouse. The strange thing is that the first zoom is really slow, and so is the first panning. So if you zoom into an image it will first take some time, and when trying to pan the image around things will be really choppy.

However if i zoom into the image even more, and then zoom back out to the same place i was before zooming even more, the drawing is now very smooth and fast when zooming and panning.

It is almost as when zooming extra memory gets allocated or the image is cached in some way which makes it really fast. Like you need to "warm up" the photo before it can be drawn fast on the screen?

Now I need to know why I get this behaviour and if I can improve it in any way?

I only use:

gc.DrawImage(image, left, top, width, height), with left, top and so on beeing adjusted according to the zoom and panning, to create the effect of zooming and panning the image around on screen.

One solution would ofcourse to use WPF but I want to get it working in GDI+! It must be related to how an image is drawn inside a graphical context or something!

Hope anyone got an answer! Thanks! /Johan
Mar 18 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.