1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Option Explicit
Const SRCCOPY = &HCC0020
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
Dim ret As Long
Dim PL As Long
Dim PT As Long
Dim PW As Long
Dim PH As Long
Dim HDCSour As Long
Dim HDCDest As Long
Private Sub Form_Load()
Picture1.ScaleMode = vbPixels
Picture1.AutoRedraw = True
Picture2.ScaleMode = vbPixels
Picture2.AutoRedraw = True
End Sub
Private Sub Command1_Click()
PL = Picture1.ScaleLeft
PT = Picture1.ScaleTop
PW = Picture1.ScaleWidth
PH = Picture1.ScaleHeight
HDCSour = Picture1.HDC
HDCDest = Picture2.HDC
StretchBlt HDCDest, PL, PT, PW, PH, HDCSour, PL, PT + PH, PW, -PH, SRCCOPY
Picture2.ScaleMode = 5
Picture2.Refresh
End Sub |
Partager