When I had to do this, I created a control that was a picture box in a
panel.  When the Image property is assigned, resize the picture box to the
same aspect ratio but with the largest dimensions that will fit in the
panel.

David

"If we can hit that bullseye, the rest of the dominoes
 will fall like a house of cards... checkmate!"
 -Zapp Brannigan, Futurama



On Wed, Nov 16, 2011 at 14:16, Ian Thomas <[email protected]> wrote:

>  Arjang – not stretching: I want to keep the correct aspect ratio (think
> TV in 4:3 ratio, versus making it fit into 16:9). Zoom does resize the
> image, but keeps the correct aspect ratio. Stretching causes distortion. *
> ***
>
> ** **
>
> In the image I pasted into my email, you can see the white space on each
> side of the image, where the image is fitted to the PB height but its width
> is different. ****
>
> ** **
>
> My guess is that (somehow) I have to resize the PictureBox itself, after
> loading (as Zoom mode), based on the best fit. I’m trying to get my head
> around that. Or, I just forget about giving it a border. ****
>
> ** **
>  ------------------------------
>
> **Ian Thomas**
> Victoria Park, ****Western Australia********
>   ------------------------------
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Arjang Assadi
> *Sent:* Wednesday, November 16, 2011 10:59 AM
> *To:* ozDotNet
> *Subject:* Re: PictureBox Image sizing / border question****
>
> ** **
>
> Are you looking for the stretching or resizing the PictureBox to be the
> size of the image?****
>
> On 16 November 2011 13:50, Ian Thomas <[email protected]> wrote:****
>
> WinForms question. I have a PictureBox, SizeMode: Zoom, anchored,
> BorderStyle: FixedSingle into which user loads an image. Since images are
> not always the same aspect ratio as the PictureBox, the border does not
> always fit the loaded image. Is there a way to make it do so?  ****
>
> ****
>  ------------------------------
>
> Ian Thomas
> Victoria Park, Western Australia****
>
> ** **
>

<<image001.jpg>>

Reply via email to