johnnous
Messages postés100Date d'inscriptionjeudi 3 mars 2005StatutMembreDernière intervention24 mai 2013
-
7 mars 2010 à 07:20
cs_davedave44
Messages postés15Date d'inscriptionsamedi 2 janvier 2010StatutMembreDernière intervention27 août 2011
-
9 mai 2010 à 21:38
bonjour
j'ai un petit soucis
j'ai une picturebox avec une image de fond dans laquelle je viens ajouter des picturesbox enfants
et je souhaiterais sauvegarder le resultat sous forme d'image avec mes picturebox enfant
cas je fais ça il ne m'enregistre que l'image de fond (copie de celle de départ)
PicBoxP1.Parent = pictureBox2;
PicBoxP1.Left = 300;
PicBoxP1.Top = 200;
PicBoxP1.BringToFront();
PicBoxP2.Parent = pictureBox2;
PicBoxP2.Left = 150;
PicBoxP2.Top = 200;
PicBoxP2.BringToFront();
pictureBox2.Image.Save(@"C:\Image.png",ImageFormat.Png );
leprov
Messages postés1160Date d'inscriptionvendredi 23 juillet 2004StatutMembreDernière intervention21 octobre 201017 9 mars 2010 à 09:49
tu peux essayer un truc comme ca :
Bitmap bitmap = new Bitmap(pictureBox2.Width, pictureBox2.Height, PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(bitmap))
{
Point p = pictureBox2.PointToScreen(pictureBox2.Location);
g.CopyFromScreen(p.Left, p.Top, 0, 0, pictureBox2.Size, CopyPixelOperation.SourceCopy);
}
johnnous
Messages postés100Date d'inscriptionjeudi 3 mars 2005StatutMembreDernière intervention24 mai 2013 9 mars 2010 à 10:38
merci
j'ai quelques modifs et ça marche super
Bitmap bitmap = new Bitmap(pictureBox2.Width, pictureBox2.Height, PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(bitmap))
{
Point p = this.PointToScreen(pictureBox2.Location);
g.CopyFromScreen(p.X , p.Y , 0, 0, pictureBox2.Size, CopyPixelOperation.SourceCopy);
}
bitmap.Save(ImageName, ImageFormat.Jpeg); // Utilise la méthode Save de Bitmap