开发者

Better way to overlap (superimpose) images in WPF?

I had a requirement to overlay two images in WPF for a project. On searching around, I finally ended up using DrawingImage class using DrawingGroup as suggest开发者_Python百科ed here: Overlay two bitmap images in WPF

var group = new DrawingGroup();
group.Children.Add(new ImageDrawing(new BitmapImage(new Uri(@"...\Some.jpg", UriKind.Absolute)), new Rect(0, 0, ??, ??)));
group.Children.Add(new ImageDrawing(new BitmapImage(new Uri(@"...\Some.png", UriKind.Absolute)), new Rect(0, 0, ??, ??)));

MyImage.Source = new DrawingImage(group);

But I got stuckup as I am unable to convert it back to BitmapImage for further manipulations.

Any other ideas on overlapping images in WPF?


I was able to accomplish my requirement using DrawingVisual class. For more info, refer here: Drawing Bitmaps – DrawingImage and DrawingVisual

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜