I have a 200x200 pictureBox, and it has an 100x100 image, which I stretch using pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
. Afterwards I want to draw an 50x50 picture on it, but not strech it.
I'm using this code, but it still stretches the 50x50 image:
//setting the pictureBoxes image
pictureBox.Image = (Image)Properties.Resources.ResourceManager.GetObject("100x100_Image");
pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
//drawing the second image
Point x = new Point(0, 0);
Bitmap bmp = new Bitmap(pictureBox.Image);
Graphics g = Graphics.FromImage(bmp);
g.DrawImage(new Bitmap((Image)Properties.Resources.ResourceManager.GetObject("50x50_Image")), x);
pictureBox.Image = bmp;
Use the Paint event of the PictureBox:
private void PictureBox1_Paint(object sender, PaintEventArgs e) {
var bmp50 = Properties.Resources._50x50_Image;
e.Graphics.DrawImage(bmp50, new Point(0, 0));
}