Image zooming

G

Gopi

Hi All
I have set a BackgroundImage for windows forms and i need
to implement the image zooming feature for the form ie
when ever i m zooming in or zooming out the form the
corrosponding background image also needs to be zoomed in
and zoomed out. the zoom factors ( zooming values are)
50%,100% and 150% how do i implement this?

thanks in advance
Gopi
 
J

Justin Weinberg

Remember you will loose image quality as you zoom out (as well as zoom in,
but less severe) so I would design for your largest case (150%).

Override OnPaint in your form. Then, in onPaint, apply
e.Graphics.ScaleTransform to resize the graphics context, and, if necessary,
an e.Graphics.TranslateTransform to make sure it's still positionally where
you want it. I typically wrap such operations in a graphics container.

There's a general example of zooming a drawn surface here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/designsurface.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top