1

現在、メトロアプリを開発しており、画像にテキストを書き込む必要があります。

これを見つけましたhttp://writeablebitmapex.codeplex.com/

しかし、私は XAML を初めて使用し、具体的な使用方法を知りません。画像にテキストを書き込むためにどのように使用するのですか?

MSDNでこの質問をしましたが、まだ返信がありません。

編集:

Muad'Dibとして使用すると、以下のスクリーンショットに示すようなエラーが発生します。

ここに画像の説明を入力

エラーは次のとおりです。'Writeable Bitmap Extensions' is ambiguous in the namespace 'System.Windows.Media.Imaging'

4

1 に答える 1

0

WriteableBitmapExのディスカッション エリアに考えられる解決策が 1 つあります。

その「記事」のコードは次のとおりです。

 public static void DrawText(this WriteableBitmap wBmp,Point at, string text,double fontSize,Color textColor)
    {        
        TextBlock lbl = new TextBlock();
        lbl.Text = text;
        lbl.FontSize = fontSize;
        lbl.Foreground = new SolidColorBrush(textColor);
        WriteableBitmap tBmp = new WriteableBitmap(lbl, null);
        wBmp.Blit(at, tBmp, new Rect(0, 0, tBmp.PixelWidth, tBmp.PixelHeight), Colors.White, System.Windows.Media.Imaging.WriteableBitmapExtensions.BlendMode.Alpha);
    }
于 2012-03-17T19:15:25.330 に答える