Results 1 to 5 of 5

Thread: [RESOLVED] size a picturebox

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2007
    Posts
    259

    Resolved [RESOLVED] size a picturebox

    Why cant a picturebox become bigger than the screen's size? My picture is bigger than the computer screen is and the picturebox cant show it all. When I make the picturebox the right size by using:
    Code:
    Picturebox.width = picturebox.picture.width
    picturebox.height = picturebox.picture.height
    it says that it "Can't create autoredraw image", so I set the autoredraw to false and my game doesnt work properly like that. I cant have the picturebox the wrong size, because when I use picturebox.point, and it does it outside of the picturebox,it doesnt return the right colour which is crucial to the game I am making.
    How can I change this?

  2. #2
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,966

    Re: size a picturebox

    Quote Originally Posted by Kaimonington
    Why cant a picturebox become bigger than the screen's size? My picture is bigger than the computer screen is and the picturebox cant show it all. When I make the picturebox the right size by using:
    Code:
    Picturebox.width = picturebox.picture.width
    picturebox.height = picturebox.picture.height
    it says that it "Can't create autoredraw image", so I set the autoredraw to false and my game doesnt work properly like that. I cant have the picturebox the wrong size, because when I use picturebox.point, and it does it outside of the picturebox,it doesnt return the right colour which is crucial to the game I am making.
    How can I change this?
    in visual basic 6 the picturebox don't scroll the image, but you can put the autosize property to true... if your image is more big than your screen, i don't know how can help you... i hope these information help you
    VB6 2D Sprite control

    To live is difficult, but we do it.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2007
    Posts
    259

    Re: size a picturebox

    oh thanks, that worked, why couldnt I just resize it myself though?

  4. #4
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,966

    Re: size a picturebox

    Quote Originally Posted by Kaimonington
    oh thanks, that worked, why couldnt I just resize it myself though?
    the picturebox has 2 types of size:
    -normal size: height and width;
    -scale size(or image size): scaleheight and scalewidth.
    now don't forget too, theres is a property that is scalemode: depending the scalemode the scale size values change...
    VB6 2D Sprite control

    To live is difficult, but we do it.

  5. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: size a picturebox

    Quote Originally Posted by Kaimonington
    oh thanks, that worked, why couldnt I just resize it myself though?
    You could, but you were not aware of the scalemode used in the .Width/.Height properties of a picture object. It is something called vbHimetrics. You need to convert that to your picbox' container's scalemode.
    Code:
    With Picturebox
       .Move .Left, .Top, _
          ScaleX(.Picture.Width, vbHimetric, .Container.ScaleMode), _
          ScaleY(.Picture.Height, vbHimetric, .Container.ScaleMode)
    End With
    Resizing a picbox to image size does not take into consideration the size of the picbox borders. So, to properly resize it manually, you also most add border width & height to you calculations too.

    Typo: vbHimetrics is not plural - should be vbHimetric & changed above.
    Last edited by LaVolpe; Apr 6th, 2008 at 12:50 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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