简体   繁体   中英

Windows Form PictureBox Save Image and Background property

with a button i choose the Image (photo Frame) and i add the image to picturebox.image property With other button i choose a Photo and i add the image to the same picturebox but to the picturebox.background

Whith another button i create a.jpg file But only save the picture.image need to save all.. .image with background.

do u know how can i save the picture with the background. many thxs

the image explain my form

It sounds like this is the sort of thing you're after:

using (var compositeImage = new Bitmap(width, height))
using (var g = Graphics.FromImage(compositeImage))
{
    g.DrawImage(myPictureBox.BackgroundImage, 0, 0);
    g.DrawImage(myPictureBox.Image, 0, 0);

    compositeImage.Save(filePath);
}

You'll need to determine exactly what size to use for the composite image and the location to draw the original images.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM