如何使用Windows Phone代码在图像上写文字? [英] how to write text on a image using windows phone code?

查看:90
本文介绍了如何使用Windows Phone代码在图像上写文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Possible Duplicate:
Write text on image in WP7

我有一个应用程序,要添加的功能之一是,在图片上方发送带有一些文本的图片.是否可以在Windows Phone中对此进行编码?

I have an app and one of the feature I want to add to it is , sending the picture with some text on top of it.IS that possible to code this in windows phone ?

推荐答案

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

Easy way is just rendering a TextBlock with the text on a WriteableBitmap

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();
}

这篇关于如何使用Windows Phone代码在图像上写文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆