在windows phone 8中通过c#将文本和图像合并到单个可写位图图像中

在windows phone 8中通过c#将文本和图像合并到单个可写位图图像中,c#,windows-phone-8,C#,Windows Phone 8,我需要在WindowsPhone8应用程序中通过c#将文本与单个可写位图图像中的图像合并。但我不知道如何将文本与图像合并,以便得到一个可写的位图图像。有人能帮我吗?我尝试了这个图像代码,但不知道如何添加图像文本 Uri uri = new Uri("Images/Unlocked.png", UriKind.Relative); StreamResourceInfo resourceInfo = Application.GetResourceStream(uri); BitmapImage im

我需要在WindowsPhone8应用程序中通过c#将文本与单个可写位图图像中的图像合并。但我不知道如何将文本与图像合并,以便得到一个可写的位图图像。有人能帮我吗?我尝试了这个图像代码,但不知道如何添加图像文本

Uri uri = new Uri("Images/Unlocked.png", UriKind.Relative);
StreamResourceInfo resourceInfo = Application.GetResourceStream(uri);
BitmapImage img = new BitmapImage();
img.SetSource(resourceInfo.Stream);
WriteableBitmap writeableBitmap = new WriteableBitmap(img);

已经有两个很好的例子:

遵循它们,您的代码可能如下所示:

BitmapImage bitmap = new BitmapImage();
bitmap.SetSource(App.GetResourceStream(new Uri("Images/Unlocked.png", UriKind.Relative)).Stream);
TextBlock drawString = new TextBlock();
drawString.Text = "Simple text";
drawString.FontSize = 12;

WriteableBitmap wb = new WriteableBitmap(bitmap);
wb.Render(drawString, null);
wb.Invalidate();

您已经设置了
WritableBimap
的图像,然后您必须在其上添加一些内容-任何
UIELement
-不仅是文本块。

我在可写位图图像中转换了一个图像,但不知道如何在其中添加文本。是否存在不可写位图?很抱歉,您没有提供代码。请使用搜索引擎-在所有C#frameworks中,向位图写入文本已被多次提出。@AnandDubey您可以通过单击文章末尾的“编辑”按钮编辑问题