如何使用Windows手机代码在图像上写文字?

krr*_*hna 1 windows-phone-7 windows-phone-7.1 windows-phone-7.1.1 windows-phone-8

可能重复:
在WP7中的图像上写入文本

我有一个应用程序和我要添加到其中的功能之一是,在它上面发送一些文本的图片.可以在Windows手机中编码这个吗?

Ped*_*mas 5

简单的方法是使用WriteableBitmap上的文本呈现TextBlock

private void RenderString(WriteableBitmap bitmap, string stringToRender)
{
    TextBlock textBlock = new TextBlock();
    textBlock.Text = stringToRender;

    // set font, size, etc. on textBlock

    bitmap.Render(textBlock, null);
    bitmap.Invalidate();
}
Run Code Online (Sandbox Code Playgroud)