le cancre
Messages postés
292
Date d'inscription
mercredi 25 octobre 2006
Statut
Membre
Dernière intervention
27 novembre 2009
4 nov. 2006 à 15:52
tu as besoin de 2 pictureBox
picture1 <-- qui contient ton image
picture2 <-- qui va contenir la nouvelle image
La fonction Bitblt permet de copier une image dans un conteneur image (PictureBox, Image, Form,...). Cette fonction préservera les dimensions de l'image.
Plusieurs options de copie sont possibles à l'aide du paramètre dwRop.
hDestDC : Endroit où l'image sera copiée (ex: form1.hdc, picture1.hdc).
x : Coordonnée en x du coin supérieur gauche d'où l'image sera copiée.
y : Coordonnée en y du coin supérieur gauche d'où l'image sera copiée.
nWidth : Largeur de l'image.
nHeight : Hauteur de l'image.
hSrcDC : Endroit d'où l'on prend l'image.
xSrc : Coordonnée en x du coin supérieur gauche de l'image source.
ySrc : Coordonnée en y du coin supérieur gauche de l'image source.
dwRop : Méthode utilisée pour copier l'image, voir la liste des
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC 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 dwRop As Long) As Long
Public Sub CopieImage(xPicSource as PictureBox,xLargeur as long,xHauteur as long,xPicDestination as Picturebox)
BitBlt xPicDestination.hdc, 0, 0, xPicSource.Width, xPicSource.Height, xPicSource.hdc, 0, 0, vbSrcCopy
SavePicture xPicDestination.Image, App.Path & "\ImageWebCam.jpg"
End sub
Public sub Ecrire(xPic as Picturebox,x as long,y as long,Phrase as string )
xPic.currentx = x
xPic.currenty = y
xPic.print Phrase
end sub
' exemple d'utilisation
Private Sub Command1_Click()
Ecrire Picture1,0,0,Date
CopieImage Picture1,picture1.width,picture1.height,picture2
end sub