How do I stretch a picture to fit a picturebox?
Printable View
How do I stretch a picture to fit a picturebox?
Why not you use the Image control with Stretch properties = true?
or you can use the BilBlt API function to stretch a picture.
I need to use the Picturebox control, can anyone give me some code to strecth the picture?
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