Search code examples
c#graphicscompact-framework

Resizing images in Compact Framework (both bigger and smaller)


I'm trying to make a zoomable image control for the CF and I read Chris's article on how to use the IImage interface to shrink big files to be displayed on the screen, but I want to also take small images (400x400 ish) and zoom them to fill the screen (either 480x480 or even 800x800). Is there a secret to doing this? Also, if the image is 800x800, how can I specify which portion of the image is going to be clipped? And finally, does anyone know if the source is available for the link that I provided?

Thanks for any help!


Solution

  • 95% of the code in the app that you see the screenshot of is actually in that blog entry text. There wasn't much to it. The only thing missing is teh designer-generated code for the button and two picture boxes.

    Stretching an image is very easy. Just use the Graphics.DrawImage to draw the smaller source into the larger destination and the framework will do the stretch for you.