Declare Function StretchBlt Lib "gdi32.dll" (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 hSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
StretchBlt copies a piece of an image from one object to another. This function also allows you to change the original size and dimensions of the image piece, unlike the related function BitBlt. In addition to using the straight "copy" method, you can specify other ways of copying the image with the dwRop parameter. The point you specify to put the image in the target object will be the upper-left corner of the piece. The function returns 0 if the function failed and a non-zero value if it succeeded.
Example:
' Copy a 16x32 rectangle from the upper-left corner of one picture box to another,
' stretching the width to double its original amount
x = StretchBlt(picTarget.hdc, 0, 0, 32, 32, picSource.hdc, 0, 0,16, 32, SRCCOPY)
picTarget.Refresh ' show the updated image
Related Call: BitBlt
Category: Graphics
Back to the index.