471,082 Members | 709 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,082 software developers and data experts.

Difference between Image1.Picture.Width and Image1.width

Hi,

I was wondering if someone could explain to me what the difference is
between the width propery of the picture property of an image and the width
property of the image itself.

I would have guessed that when the stretch property of an image was set to
false and an image was assigned to the picture property, that
Image1.Picture.Width and Image1.width would be the same. This is not the
case.

I need to know with what factor an image is stretched when stretched = true,
and I thought I could use these two different width properties, thinking
that Image1.width is the stretched width and Image1.Picture.width is the
actual width of the image.

Can someone help me figure this out?

Thanks in advance,
Sandra
Jul 17 '05 #1
2 7090
> I was wondering if someone could explain to me what the difference is
between the width propery of the picture property of an image and the width property of the image itself.

I would have guessed that when the stretch property of an image was set to false and an image was assigned to the picture property, that
Image1.Picture.Width and Image1.width would be the same. This is not the case.

I need to know with what factor an image is stretched when stretched = true, and I thought I could use these two different width properties, thinking that Image1.width is the stretched width and Image1.Picture.width is the actual width of the image.

Can someone help me figure this out?


The Width property of the Picture object contained within the ImageBox
is measured in something called HIMETRIC units. You can find out more
about this by looking up "HIMETRIC scale mode for value" (without the
quote marks) at the Index tab in VB's help files. To convert the
HIMETRIC units of the Picture to, say TWIPS (the assumed unit of measure
for your ImageBox), you would use the ScaleX and ScaleY methods (see the
help files for all of the conversion types possible).

ScaleX(Image1.Picture.Width, vbHimetric, vbTwips)

So, to find the scale factor by which your picture has been shrunk or
stretched, you could do this

ScaleFactorX = Image1.Width / ScaleX(Image1.Picture.Width, _
vbHimetric, vbTwips)
ScaleFactorY = Image1.Width / ScaleY(Image1.Picture.Width, _
vbHimetric, vbTwips)

Rick - MVP
Jul 17 '05 #2
"Rick Rothstein" <ri************@NOSPAMcomcast.net> wrote:
So, to find the scale factor by which your picture has been shrunk or
stretched, you could do this

ScaleFactorX = Image1.Width / ScaleX(Image1.Picture.Width, _
vbHimetric, vbTwips)
ScaleFactorY = Image1.Width / ScaleY(Image1.Picture.Width, _
vbHimetric, vbTwips)

Yes, this is what I was looking for. Thank you.

Sandra
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Yang Li Ke | last post: by
2 posts views Thread by Lyn | last post: by
4 posts views Thread by Andre Nogueira | last post: by
5 posts views Thread by jason.tadeo | last post: by
4 posts views Thread by SandyIsCool | last post: by
3 posts views Thread by find clausen | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.