美好的一天!
我试图让4张图片在一张照片中发生碰撞,而在添加每张照片时,它会更新图片框。
但是,在我尝试使用以下代码之后:
using (Image image = Image.FromFile(@"C:\emo\res1.png")) --> this is the image that is attached to the picture box. using (Image watermarkImage = Image.FromFile(@"C:\emo\eyes\Eyes-01.png")) using (Graphics imageGraphics = Graphics.FromImage(image)) using (Brush watermarkBrush = new TextureBrush(watermarkImage)) { imageGraphics.FillRectangle(watermarkBrush, new Rectangle(new Point(0, 0), image.Size)); image.Save(@"C:\emo\res1.png", System.Drawing.Imaging.ImageFormat.Png); } pictureBox1.ImageLocation = @"C:\emo\res1.png"; this.pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
它不起作用,因为它说它正在被另一个进程使用。