Results 1 to 5 of 5

Thread: Fitting a picture in an IMAGE or PICTUREBOX...

  1. #1

    Thread Starter
    Lively Member bgalm's Avatar
    Join Date
    Jan 1999
    Posts
    65

    Question

    Hello,
    I have some BMPs, JPGs, etc. that my progam "previews". Problem is, is some of the pics are too big to fit in either the IMAGE or PICTUREBOX controls. How can I "fit" the picture, or have the pic automatically scale up or down to "fit" inside the box ?
    I am using VB6.
    Thanks,

  2. #2
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    If you use the image contol and set its Stretch property to TRUE then any picture you place inside will automatically resized to the image box size.

    Hope this helps

    Shaun

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    For scale use the stretch property on the image box.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4
    Guest
    When using a PictureBox, use PaintPicture. Make a Form with 2 PictureBoxes. Load your image in Picture2 and insert the following code into the Load() event.
    Code:
    Private Sub Form_Load()
    
        'Make Picture2 invisible
        Picture2.Visible = False
        'ReDraw the Picture so it doesn't get cut off
        Picture1.AutoRedraw = True
        'Draw the Picture on to Picture1
        Picture1.PaintPicture Picture2.Picture, 0, 0, Picture1.Width, Picture1.Height
        
    End Sub

  5. #5

    Thread Starter
    Lively Member bgalm's Avatar
    Join Date
    Jan 1999
    Posts
    65

    Smile Thanks everyone...

    ...everything seems to be working now, thanks for all the help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width