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

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

问题描述

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

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

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 ?

推荐答案

简单的方法就是渲染一个 TextBlock 和 WriteableBitmap 上的文本

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天全站免登陆