stuck with my program

search4
02-03-2005, 02:10 AM
Im totally stuck with my program...I've included it so that you guys and gals can take a look at it.

When I select a bmp (by double clicking the filelistbox), it stretches to fit the picture1 window. Thats exactly the idea... However when I want to do this with jpg files it only works with a couple of them. Ofcourse its the idea that it should work on all jpg files.

Also when i press the save button the picture in the picturebox is saved as bmp.. I want to store it as jpg

Who can help me ?

VB_Alien
02-03-2005, 07:49 AM
An easy workaround for stretching the picture is to use the API StretchBlt. I added another picturebox to hold the accual image selected and then used StretchBlt to resize the picture to picture1 width and height.

As far as saving pictures in the same file format, you could use GDI Plus. Although i havent used it much, it possibly could do the resizing of pictures to. I re-attach your program with my changes.

search4
02-03-2005, 09:00 AM
Thanks for looking in to it.. The stretching part seems to work now with the jpg's.
However when i load big jpg in the picturebox...some colours seem to change..

VB_Alien
02-03-2005, 03:41 PM
OK! Since i dont use GDIPlus, i did some seaching and found a bit of code that resizes pictures. I went ahead and made a demo for you to try. I included a windows jpg file at 800x600 resolution and it worked fine for me. Hope it works good for you. Of coarse you may have to install the latest version of GDIPlus if you dont have it yet.



I found some more code that saves your picturebox image in jpg format. I added this code to my demo. Of course, you will need to handle all the file loading and saving since i just hard-coded mine.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum