Petit problème avec la manipulation d'image
Je veux redimensionner une image avant de l'imprimer mais j'ai un parameterException dans la ligne en gras (paramètre invalide).
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
Image img = Image.FromFile(fiche.getPImage());
if ((img.Height > 1000)|| (img.Width > 700))
{
int coef1 = 1000/img.Height;
int coef2 = 700/img.Width;
Bitmap im;
if ( coef1 > coef2)
{
im = new Bitmap(img, new Size(img.Width * coef2,img.Height * coef2));
}
else
{
im = new Bitmap(img, new Size(img.Width * coef1,img.Height * coef1));
}
this._gfx.DrawImage(im, (margin.Width - im.Width) / 2 ,this._point.Y);
} |
Quelle erreur j'ai fais ?