Results 1 to 4 of 4

Thread: Stretching image inside picturebox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Højslev, None, Denmark
    Posts
    75

    Wink

    How do I stretch a picture to fit a picturebox?
    Queen ROCKS!!!!!

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Why not you use the Image control with Stretch properties = true?

    or you can use the BilBlt API function to stretch a picture.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Højslev, None, Denmark
    Posts
    75

    Red face None.

    I need to use the Picturebox control, can anyone give me some code to strecth the picture?
    Queen ROCKS!!!!!

  4. #4
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Use this code to strech a picture in a picture box:

    Code:
    Public Declare Function StretchBlt Lib "gdi32" (ByVal hdc 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
    
    StretchBlt DestinationPic.hdc, 0, 0, DestinationPic.ScaleWidth, DestinationPic.ScaleHeight, SourcePic.hdc, 0, 0, SourcePic.ScaleWidth, SourcePic.ScaleHeight, vbSrcCopy
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

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