Picturebox save

Résolu
johnnous Messages postés 100 Date d'inscription jeudi 3 mars 2005 Statut Membre Dernière intervention 24 mai 2013 - 7 mars 2010 à 07:20
cs_davedave44 Messages postés 15 Date d'inscription samedi 2 janvier 2010 Statut Membre Dernière intervention 27 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 );


Jean louis

3 réponses

leprov Messages postés 1160 Date d'inscription vendredi 23 juillet 2004 Statut Membre Dernière intervention 21 octobre 2010 17
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);
}
3
johnnous Messages postés 100 Date d'inscription jeudi 3 mars 2005 Statut Membre Dernière intervention 24 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

Jean louis
3
cs_davedave44 Messages postés 15 Date d'inscription samedi 2 janvier 2010 Statut Membre Dernière intervention 27 août 2011
9 mai 2010 à 21:38
Bonjours comment fair pour enregistrer sous l'image de mon pictureBox avc un saveFileDialogue

[^^conf
0
Rejoignez-nous