PDA

Click to See Complete Forum and Search --> : Stretching image inside picturebox


Bjarke.ip
Nov 23rd, 2000, 04:54 AM
How do I stretch a picture to fit a picturebox?

Chris
Nov 23rd, 2000, 05:25 AM
Why not you use the Image control with Stretch properties = true?

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

Bjarke.ip
Nov 23rd, 2000, 05:55 AM
I need to use the Picturebox control, can anyone give me some code to strecth the picture?

Vlatko
Nov 23rd, 2000, 06:28 AM
Use this code to strech a picture in a picture box:


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