Image zooming

  • Thread starter Thread starter Gopi
  • Start date Start date
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
 
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
 
Back
Top