Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Image - stretch or size property? (VB 5 / 6)

    Is there a way to control the aspect ratio of a graphic as displayed in an image control in VB5 or 6? So far, all I have been able to do is to make the graphic (JPG) fill the image control completely. Of course, this distorts many photographs.

    I want to make the photograph as large as possible within the size of the control, yet retain its proper aspect ratio. It's easy enough in Access or VBA to accomplish this using the various Size Mode properties, but it's eluding me in VB 5 and 6.

    Thx.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  2. #2
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Image - stretch or size property? (VB 5 / 6)

    Jack, in VB with an Image control, you have 2 choices:
    1) .Stretch = True causes the image to be resized to fit the current width and height of the control, or
    2) .Stretch = False causes the width and height of the control to be changed to the current width and height of the image. So, to keep the aspect ratio, you would want to initially set Stretch = False, load the image, check the new Height and Width, set stretch = True, and finally decrease the image control's height and width by the appropriate percent. HTH --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image - stretch or size property? (VB 5 / 6)

    Thanks Sam. worked like a charm.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

Posting Permissions

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