在我的应用程序中有一个完整尺寸的框架和一个较小尺寸的内部图片。我希望内部的在框架内部和顶部。所以这就是我所做的:
var resourceStream = Application.GetResourceStream(new Uri("Assets/Frame.png", UriKind.Relative));
var frame = new BitmapImage();
frame.SetSource(resourceStream.Stream);
WriteableBitmap finalImage = new WriteableBitmap(frame);
using (MemoryStream memoryStream = new MemoryStream())
{
BitmapImage innerImage = new BitmapImage(new Uri(string.Format("Assets/Pages/{0}.png", page), UriKind.Relative));
Image image = new Image();
image.Height = innerImage.PixelHeight;
image.Width = innerImage.PixelWidth;
image.Source = innerImage;
TranslateTransform translateTransform = new TranslateTransform();
translateTransform.X = 52;
translateTransform.Y = 60;
finalImage.Render(image, translateTransform);
finalImage.Invalidate();
finalImage.SaveJpeg(memoryStream, frame.PixelWidth, frame.PixelHeight, 0, 100);
memoryStream.Seek(0, System.IO.SeekOrigin.Begin);
PagePicture.Source = finalImage;
}
但我只看到没有内部图像的框架。我猜可能是在框架后面。我该如何解决这个问题?
或者也许我可以在不合并的情况下同时拥有两个控件?让我试试