A PictureBox Problem

前端 未结 5 560
余生分开走
余生分开走 2020-11-27 07:36

I have a problem:

I have 3 picture boxes with 3 different images as in Image

what can i set to pictureBox3 so both images l

5条回答
  •  囚心锁ツ
    2020-11-27 08:32

    This code will do the trick:

    using (Graphics g = Graphics.FromImage(pictureBox1.Image))
    {
        g.DrawImage(pictureBox2.Image, 
            (int)((pictureBox1.Image.Width - pictureBox2.Image.Width) / 2),
            (int)((pictureBox1.Image.Height - pictureBox2.Image.Height) / 2));
        g.Save();
        pictureBox1.Refresh();
    }
    

    It will draw the image from pictureBox2 on the existing image of pictureBox1.

提交回复
热议问题