【问题标题】:Using WriteableBitmapEx使用 WriteableBitmapEx
【发布时间】:2012-03-17 18:43:33
【问题描述】:

我目前正在开发 Metro 应用程序,我需要在图像上写文字。

我找到了这个http://writeablebitmapex.codeplex.com/

但我是 XAML 的新手,并且不知道如何专门使用它。 所以谁能告诉我如何使用它来在图像上写文字。

我在MSDN 上问过这个问题,但我还没有回复。

编辑:

如果我使用 Muad'Dib 我会收到如下截图所示的错误:

错误是:'Writeable Bitmap Extensions' is ambiguous in the namespace 'System.Windows.Media.Imaging'

【问题讨论】:

  • WriteableBitmapEx 库也在 NuGet 上

标签: vb.net microsoft-metro writeablebitmapex


【解决方案1】:

Discussions area for WriteableBitmapEx 中有一种可能的解决方案

这是那篇“文章”的代码:

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

【讨论】:

  • @Muad-最近我已经发布了关于这个的讨论并且我得到了更新的错误。
  • 我在讨论中发布的代码是用 C# 编写的,我在您的图片中看到您正在使用 VB。我不懂VB,在这里帮不了多少。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多