Hi Greg,

Without going under the hood, you'll probably want to add a couple more
layers to your component.   The backgroundImage propeties of a container
don't allow you to use the maintainAspectRation property.  However, the
Image control does.  So, one way that you can work around this is to use
a Canvas as the main component container and layer a VBox on top of an
Image (used for the backgroundImage).  This gets trick sometimes;
depending on how you set the parent and/or child dimensions.   But, if
you set either the Image height or width exclusively, and use the
maintainAspectRatio, the image will scale correctly.

-TH








--- In [email protected], "Greg Hess" <[EMAIL PROTECTED]> wrote:
>
> Hi Folks,
>
> Our application lets a user specify an image to use as a background
for a
> component. We need to scale the image to fill the VBox container (max
width
> or height) respecting the aspect ratio of the image. I have been
setting the
> backgroundImage, and backgroundSize="100%" styles on the VBox but the
image
> is being stretched.
>
> How can I do this?
>
> Cheers,
>
> Greg
>



Reply via email to