How can I overlay one image onto another?

Posted by Edward Tanguay on Stack Overflow See other posts from Stack Overflow or by Edward Tanguay
Published on 2010-03-19T17:03:00Z Indexed on 2010/03/19 17:11 UTC
Read the original article Hit count: 346

Filed under:
|
|
|
|

I would like to display an image composed of two images.

I want image rectangle.png to show with image sticker.png on top of it with its left-hand corner at pixel 10, 10.

Here is as far as I got, but how do I combine the images?

Image image = new Image();
image.Source = new BitmapImage(new Uri(@"c:\test\rectangle.png"));
image.Stretch = Stretch.None;
image.HorizontalAlignment = HorizontalAlignment.Left;

Image imageSticker = new Image();
imageSticker.Source = new BitmapImage(new Uri(@"c:\test\sticker.png"));

image.OverlayImage(imageSticker, 10, 10); //how to do this?

TheContent.Content = image;

© Stack Overflow or respective owner

Related posts about wpf

Related posts about c#