Bonjour,
Je suis en train de mettre en place une édition et j'ai un problème avec le redimensionnement de mes images.
J'arrive à charger le contenu de l'image dynamiquement, mais pour la retailler, je galère.
J'ai trouvé sur le net cette astuce :
Le MyEditionV.Section10.ReportObjects[0] représente mon objet Picture.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 System.Drawing.Image thePicture = (System.Drawing.Image)System.Drawing.Image.FromFile(ds.EnteteL[0].Plan1); int xRatio; int yRatio; xRatio = MyEditionV.Section10.ReportObjects[0].Width / thePicture.Width; yRatio = MyEditionV.Section10.ReportObjects[0].Height / thePicture; if(xRatio< yRatio) { MyEditionV.Section10.ReportObjects[0].Width = thePicture.Width; MyEditionV.Section10.ReportObjects[0].Height = thePicture.Height * xRatio; } else { MyEditionV.Section10.ReportObjects[0].Height = thePicture.Height; MyEditionV.Section10.ReportObjects[0].Width = thePicture.Width * yRatio; }
Mon problème : l'unité de taille de mon image .jpg est le pixel. Et l'unité du report m'est inconnue.
Ce qui fait que le code retaille un peu (beaucoup) n'importe comment. Quelqu'un à déjà fait ça ou peut de donner une correspondance entre l'unité de mesure d'un report et le pixel.
Merci de vos réponse.
Partager