2011-02-07 27 views
2

我有一個項目需要重疊WPF中的兩個圖像。在周圍尋找,我終於結束了使用使用DrawingGroup DrawingImage類的建議在這裏:Overlay two bitmap images in WPF更好的方式在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); 

但我得到stuckup,因爲我無法將其轉換回BitmapImage的進一步操作。

關於WPF中重疊圖像的其他想法?

+0

你想實現什麼?爲什麼你需要轉換回來? – Vlad 2011-02-07 09:12:37

回答