Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPublic Const SRCCOPY = &HCC0020 Public 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 Sub Form_Load() ' Picture1: mettre propriété AutoSize à True ' Picture2: mettre propriété AutoRedraw à True ' Mettre propriété Appearance à 0 (plat) et BorderStyle à 0 (Aucun) pour les deux contrôles Image. ' ---Initialisation--- Picture1.ScaleMode = vbPixels Picture2.ScaleMode = vbPixels Me.ScaleMode = vbPixels ' Charger une image dans Picture1 Picture1.Picture = LoadPicture("C:\IMAGES\01.BMP") End Sub Private Sub CmdAfficher_Click() ' ---Déclaration des variables--- Dim Ret As Long Dim Hauteur As Long Dim Largeur As Long Dim Zoom As Single ' ---Définir le ratio Zoom = 0.50 Hauteur = CLng(Zoom * Picture1.Height) Largeur = CLng(Zoom * Picture1.Width) ' ---COPIER la bitmap de la zone d'image source--- With Picture2 .Width = Largeur .Height = Hauteur End With Ret = StretchBlt(Picture2.hDC, 0, 0, Largeur, Hauteur, _ Picture1.hDC, 0, 0, Picture1.Width, Picture1.Height, _ SRCCOPY) Picture2.Picture = Picture2.Image End Sub