Saving Resized Images from a PictureBox

Audax321

Well-known member
Joined
May 4, 2002
Messages
90
Hello,

This question is regarding VB .NET. I have a picture box where an image is set (in the image property) and is stretched when the size of the picture box changes. How can I save the stretched version to the hard drive?? Right now when I use:

Code:
picturebox.image.save(filename)

it just saves the original unstretched image.

Also, can I set this stretched image directly to the backgroundimage property of a panel without saving it to disk first???

Thanks.
 
Last edited by a moderator:
Hello,

I think that may work. But, Im not sure what I should put for this:

Code:
callback as System.Drawing.Image.GetThumbnailImageAbort

I tried looking it up but Im confused now....
 
You need to create a GetThumbnailImageAbort delegate sub. Its ignored so it doesnt much matter:
Code:
    Private Function ThumbCallback() As Boolean
        Return False
    End Function
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim big As Image, small As Image
        Dim callback As New Image.GetThumbnailImageAbort(AddressOf ThumbCallback)

        ....

        small = big.GetThumbnailImage(10, 10, callback, IntPtr.Zero)
    End Sub
 
Back
Top