【问题标题】:How to render html to image format如何将html呈现为图像格式
【发布时间】:2011-06-13 18:24:55
【问题描述】:

我想将“Hello dalvir”渲染为图像格式,以便 hello dalvir 在图像中显示为红色。我如何在 C# 中做到这一点。

【问题讨论】:

标签: c# asp.net


【解决方案1】:

这里是代码...

Font MyFont = new Font(FontFamily, Font,FontStyle.Bold, GraphicsUnit.Point);
MyGraphics = Graphics.FromImage(bmpImage);
MyGraphics.Clear(Color.FromName("Red"));
MyGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;
MyGraphics.DrawString("Hello dalvir", MyFont,
                    new SolidBrush(Color.FromName("Red")), 0, 0);
MyGraphics.Flush();

【讨论】:

  • 我想直接使用 html,比如“hello davir”将在 html 标记中,具有应用红色的样式。遇到这种情况我该怎么办?
猜你喜欢
  • 2023-02-03
  • 2011-11-05
  • 2014-01-27
  • 1970-01-01
  • 1970-01-01
  • 2011-09-09
  • 1970-01-01
  • 2015-03-11
  • 2019-03-06
相关资源
最近更新 更多