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
| Sub PutFiliOn(imgbase, img As String, destination As String)
Dim GDI, ratio As Double
On Error GoTo ErrMan
Set GDI = New clGdiplus
' charge l'image de fond
GDI.LoadFile (imgbase)
ratio = CDbl(DLookup("Chemin", "Chemins", "Fonction='Attrib_Img_Ratio'"))
With GDI
'dessine un rectangle sur l'image de fond
.DrawRectangle 100, 100, _
GDI.ImageWidth - 100, GDI.ImageHeight - 100, , vbRed, 1, , 0, "MaRegion"
.ImgNew("MonImage").LoadFile img
' Applique le filigrane
.DrawImg "MonImage", 100, 100, _
GDI.ImageWidth - 100, GDI.ImageHeight - 100, _
, GdipSizeModeStretch, GdipAlignCenter, 50
.ImageKeep
' Redimensionnement
'........................
.SaveFile destination
.ImgDelete "MonImage"
End With
Set GDI = Nothing
Fin:
Exit Sub
ErrMan:
MsgBox (Error(Err))
Resume Next
End Sub |
Partager