StretchBlt copies a section of an image from one device to another. This function also allows you to change the original size and dimensions of the image section, 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. What the function actually does is perform a binary operation on the color of the source and destination pixel to calculate the color of the pixel in the transfered image. The point you specify as the location of the copied image in the target object will be the upper-left corner of the image portion. The function returns 0 if the function failed and 1 if it succeeded.
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
The device context of the target object (the one that receives the image piece).
The x coordinate of the point to put the image inside the target.
The y coordinate of the point to put the image inside the target.
The width of the image piece in the target.
The height of the image piece in the target.
The x coordinate of the upper-left corner of the image piece in the source.
The y coordinate of the upper-left corner of the image piece in the source.
The width of the image piece in the source.
The height of the image piece in the source.
Exactly one of the following flags specifying what method to use to copy the source image:
SRCAND = &H8800C6
Logically And the two color values (destination = source And destination).
SRCCOPY = &HCC0020
Copy the source image exactly (destination = source).
SRCERASE = &H440328
Logically And the source image and the destination's binary inverse (destination = source And (Not destination).
SRCINVERT = &H660046
Logically Xor the two color values (destination = source Xor destination).
SRCPAINT = &HEE0086
Logically Or the two color values (destination = source Or destination).
Dim retval As Long
retval = BitBlt(PictureBox2.hdc, 0, 0, 48, 32, PictureBox1.hdc, 45, 50, 16, 32, SRCCOPY)