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 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| Private 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 nSrcWidth As Long, _
ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Const SRCCOPY = &HCC0020
Private Sub Form_Activate()
coucou.Picture = picMain.Picture
Dim rapfin As Single
With jmf
.AutoRedraw = True
.AutoSize = True
End With
With coucou
.AutoRedraw = True
.AutoSize = True
.Visible = False
End With
With picMain
.AutoRedraw = True
.AutoSize =true
End With
If coucou.Height >= coucou.Width Then
rapfin = coucou.Width / coucou.Height
picMain.Height = jmf.Height
picMain.Width = jmf.Height * rapfin
Else
rapfin = coucou.Height / coucou.Width
picMain.Width = jmf.Width
picMain.Height = jmf.Width * rapfin
End If
picMain.Left = (jmf.Width - picMain.Width) / 2
picMain.Top = (jmf.Height - picMain.Height) / 2
Ret = StretchBlt(picMain.hDC, 0, 0, picMain.Width, picMain.Height, _
coucou.hDC, 0, 0, coucou.Width, coucou.Height, _
SRCCOPY)
picMain.Picture = picMain.Image
picMain.Refresh
End Sub |
Partager