在PictureBox中组合多个图像可以使用以下方法之一:
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Image image1 = Image.FromFile("image1.jpg");
Image image2 = Image.FromFile("image2.jpg");
g.DrawImage(image1, 0, 0);
g.DrawImage(image2, 100, 100);
}
private void CombineImages()
{
Image image1 = Image.FromFile("image1.jpg");
Image image2 = Image.FromFile("image2.jpg");
Bitmap combinedImage = new Bitmap(image1.Width + image2.Width, Math.Max(image1.Height, image2.Height));
using (Graphics g = Graphics.FromImage(combinedImage))
{
g.DrawImage(image1, 0, 0);
g.DrawImage(image2, image1.Width, 0);
}
pictureBox1.Image = combinedImage;
}
这样就可以在PictureBox中显示多个图像组合的效果。