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
|
Option Compare Database
Option Explicit
Private Sub Détail_Format(Cancel As Integer, FormatCount As Integer)
Dim clImg As ClImage
Dim lImgWidth As Long, lImgHeight As Long
If FormatCount = 1 Then
' Initialise la classe Image
Set clImg = New ClImage
' Initialisation du contrôle image
clImg.SetImgCtrl Me.ImgPhoto
' On remplit l'image de la couleur de fond de l'état
clImg.FillColor Me.Section(acDetail).BackColor
' Limite la taille de l'image chargée à la largeur du contrôle
' (gain de mémoire et de temps d'exécution pour la rotation)
lImgWidth = Me.ImgPhoto.Width
' Chargement de l'image (avec miniature EXIF si elle existe)
clImg.ImageListAdd "Photo", Me.fichier.Value, lImgWidth, lImgHeight, , , , True
' Dessine l'image
' Si l'image est verticale on la tourne de 90 degrés vers la gauche
clImg.PaintImage "Photo", 0, 0, Me.ImgPhoto.Width, Me.ImgPhoto.Height, , _
Me.ImgPhoto.SizeMode, Me.ImgPhoto.PictureAlignment, , , _
IIf(lImgHeight > lImgWidth, "ROTATELEFT", Null)
' Supprimer l'image après l'avoir dessinée
clImg.ImageListDel "Photo"
' Applique les changements dans le contrôle image
clImg.Repaint
' Libère la classe Image
Set clImg = Nothing
End If
End Sub |
Partager