Results 1 to 4 of 4

Thread: to change the size of image viewed in picturebox

  1. #1
    Guest
    here is my code to loop through images found
    in a directory,

    For iX = LBound(pics()) To UBound(pics())
    Set Picture1 = LoadPicture(pics(iX))
    Sleep (lTime)
    Next

    i am trying to get the image, if it is too large
    to fit in the picture box, to reduce in size to
    fit without becoming distorted, perhaps even being
    centered within the picture box.

    i have toyed with the width and height properties,
    but can't seem to get it correct.

    can someone help,
    larryn

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    why not use the imagebox control
    that way you can set the Stretch property to true
    and set the size of the image box to your desired size
    and then every picture will size itself to the size
    of the image box.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    New Member
    Join Date
    Oct 2000
    Location
    CT
    Posts
    5
    Hey larryn I'm actually working on obtaining the same thing and have found that if you use the paintpicture method of the Picture Control what you trying to get will work for smaller pictures. but if your picture has a bigger resolution than 800 * 600 (aprox)the image gets distorded or
    you loose part of the pic.

    If you get an answer please share...


    This is what I have so far, my video is set at 800 * 600
    and I'm copying the image from Picture Control 1 to Picture Control 2.


    Form2.Picture2.Height = 8000
    Form2.Picture2.Width = 8000

    Form2.Picture2.PaintPicture LoadPicture(path), 0, 0, _
    Form2.Picture1.ScaleWidth, Form2.Picture1.ScaleHeight

  4. #4
    Guest
    Instead:

    Code:
    Form2.Picture2.Height = 8000 
    Form2.Picture2.Width = 8000 
    
    Form2.Picture2.PaintPicture LoadPicture(path), 0, 0, _ 
    Form2.Picture2.ScaleWidth, Form2.Picture2.ScaleHeight
    Or...

    Code:
    'Declarations
    Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    Public Const SRCCOPY = &HCC0020 
    
    'Paint
      BitBlt Picture2, 0, 0, Picture2.Width, Picture2.Height, LoadPicture(Path), 0, 0, SRCCOPY
    ?

Posting Permissions

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



Click Here to Expand Forum to Full Width