• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

VB6 - saving an edited file

fLum0x

Golden Member
I have an image that I can browse for and select from anywhere on the computer. It will populate into a picture box and resize itself with the following code.

Code:
Image1.Visible = False
Image1.Picture = LoadPicture(WallInnerGraphic)
Dim x, Y As Single
x = Image1.Width
Y = Image1.Height
Do While x > picWallInner.Width Or Y > picWallInner.Height
    x = x / 1.01
    Y = Y / 1.01
Loop
picWallInner.Width = x
picWallInner.Height = Y
picWallInner.PaintPicture Image1.Picture, 0, 0, x, Y

now, what i am trying to do is take this 800x600 image that is stored in picWallInner and save the file. The following code saves the picture to the location.

Code:
SavePicture picWUGInner.Image, "path\path.jpg"

Insert a path and file structure in, and this will work. ALTHOUGH! What happens is that this saves the original image (800x600) and not the newly edited file that was resized down to roughly 50x50. It does save the image in a 50x50 square, but it is the upper left corner of the image. So, everything is right except the resizing of the image to fit in this 50x50 size. When you select this file, it does populate picWUGInner.Image correctly in a 50x50 square and sized correctly, but it does not save like this. Another interesting thing is that if you alt tab out of the program to look at another application and come back, the image changes to the upper left 50x50 pixels. I have not ran a single step in the program, but the image is not the resized one anymore. Does anyone have any idea of how to fix this?
 
Here is a link that seems to do what your wanting.

If you are up to the challenge of learning them, I would mess around with the GDI+ API's. It makes many of the image related task much easier to do.

Here is a link that will load and resize images with GDI+.

Here is a link of a example and module that someone made with all of the gdi+ apis.


Anyways, That is just my opinion. 🙂



Jason
 
Back
Top