468,769 Members | 2,252 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,769 developers. It's quick & easy.

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

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
0 1363

Post your reply

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

Similar topics

reply views Thread by Thomas | last post: by
19 posts views Thread by DotNetIsHorrible | last post: by
6 posts views Thread by Scatropolis | last post: by
10 posts views Thread by Jim Hubbard | last post: by
2 posts views Thread by Frans Vander Meiren | last post: by
4 posts views Thread by =?Utf-8?B?U3BlZWR5?= | last post: by
9 posts views Thread by SAL | last post: by
9 posts views Thread by Salad | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.