【问题标题】:Combine multiple picturebox into one retaining its position将多个图片框合并为一个保留其位置的图片框
【发布时间】:2015-01-12 10:00:01
【问题描述】:

我有 3 个图片框,绿色是 1 个,这两个图像在两个不同的图片框中。我想将所有图片框拼接成一张 .jpg 图像,保留所有图像的位置。任何人都可以帮我解决代码。 4天以来一直在抓挠我的头:(

提前致谢

【问题讨论】:

    标签: c# .net save jpeg picturebox


    【解决方案1】:
            Bitmap bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);
    
            pictureBox1.DrawToBitmap(bmp, new Rectangle(0,0,pictureBox1.Width, pictureBox1.Height));
            pictureBox2.DrawToBitmap(bmp, new Rectangle(pictureBox2.Location.X - pictureBox1.Location.X, pictureBox2.Location.Y - pictureBox1.Location.Y, pictureBox2.Width, pictureBox2.Height));
            pictureBox3.DrawToBitmap(bmp, new Rectangle(pictureBox3.Location.X - pictureBox1.Location.X, pictureBox3.Location.Y - pictureBox1.Location.Y, pictureBox3.Width, pictureBox3.Height));
    
            bmp.Save(@"C:\Temp\output.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
    

    【讨论】:

    • 您好,欢迎来到 SO!请通过一些解释来改进您的答案。您的代码是做什么的,最重要的是,为什么要这样做?
    猜你喜欢
    • 2014-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-28
    • 2023-03-15
    • 1970-01-01
    相关资源
    最近更新 更多