1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| Private 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
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Dim hMemoryDC As Long
Picture1.ScaleMode = vbPixels
Picture2.ScaleMode = vbPixels
Dim sDC As Long
Dim path1, path2 As String
path1 = "c:\image\res1.bmp"
hMemoryDC = CreateCompatibleDC(Picture2.hdc)
hOldBitMap = SelectObject(hMemoryDC, Picture2.Picture)
StretchBlt Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, hMemoryDC, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, vbSrcCopy
hOldBitMap = SelectObject(hMemoryDC, hOldBitMap)
DeleteDC hMemoryDC
SavePicture Picture1.Image, path1 |
Partager