Difference between Image1.Picture.Width and Image1.width

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sandra Setz

    #1

    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
  • Rick Rothstein

    #2
    Re: Difference between Image1.Picture. Width and Image1.width

    > I was wondering if someone could explain to me what the difference is[color=blue]
    > between the width propery of the picture property of an image and the[/color]
    width[color=blue]
    > property of the image itself.
    >
    > I would have guessed that when the stretch property of an image was[/color]
    set to[color=blue]
    > false and an image was assigned to the picture property, that
    > Image1.Picture. Width and Image1.width would be the same. This is not[/color]
    the[color=blue]
    > case.
    >
    > I need to know with what factor an image is stretched when stretched =[/color]
    true,[color=blue]
    > and I thought I could use these two different width properties,[/color]
    thinking[color=blue]
    > that Image1.width is the stretched width and Image1.Picture. width is[/color]
    the[color=blue]
    > actual width of the image.
    >
    > Can someone help me figure this out?[/color]

    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.P icture.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.P icture.Width, _
    vbHimetric, vbTwips)
    ScaleFactorY = Image1.Width / ScaleY(Image1.P icture.Width, _
    vbHimetric, vbTwips)

    Rick - MVP


    Comment

    • Sandra Setz

      #3
      Re: Difference between Image1.Picture. Width and Image1.width

      "Rick Rothstein" <rickNOSPAMnews @NOSPAMcomcast. net> wrote:[color=blue]
      > So, to find the scale factor by which your picture has been shrunk or
      > stretched, you could do this
      >
      > ScaleFactorX = Image1.Width / ScaleX(Image1.P icture.Width, _
      > vbHimetric, vbTwips)
      > ScaleFactorY = Image1.Width / ScaleY(Image1.P icture.Width, _
      > vbHimetric, vbTwips)[/color]


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

      Sandra

      Comment

      Working...