how to write text on a image using windows phone c

2019-02-15 20:31发布

问题:

Possible Duplicate:
Write text on image in WP7

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 ?

回答1:

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