更改字体颜色 [英] Change color of font

查看:96
本文介绍了更改字体颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们和加尔斯...

我编写了一个应用程序,以在数据库出现故障时发送自动邮件.

一切正常...但是,现在我希望特定行的正文字体为红色".

该行在下面.

Hi Guys and Gals ...

I have written an application to send an automated mail when there is a failure in a database.

Everything works well ... however , now I want the font of the body for a specific line to be "Red".

The line is below.

mailResult.AppendLine("Previous Day Management Data Count: " + MgmtTotalDataCount);



请帮助我的建议.感谢MIL



Please help me with suggestions. Thanks a MIL

推荐答案

将您的内容设置为HTML:
Set your content to be HTML:
MailMessage mail = new MailMessage();
mail.Body = body;
mail.IsBodyHtml = true;


然后只需指定颜色即可:


Then just specify the colour:

mailResult.AppendLine("<font color=\"red\">Previous Day Management Data Count: " + MgmtTotalDataCount + "</font>");


其结果是:
前一天的管理数据计数:666

[edit]忘记使用双引号:doh:-OriginalGriff [/edit]


The result is:
Previous Day Management Data Count: 666

[edit]Forgot to escape the double quotes :doh: - OriginalGriff[/edit]


这篇关于更改字体颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆