如何为文本添加光晕效果
文字的辉光效果是一种视觉效果,能在字符周围营造出一种发光的光环。这种效果可使文字看起来像在发光,形成柔和、发光的轮廓,从而增强可读性并吸引注意力。
如何为文字添加发光效果
- 下载为文本添加发光效果的 C# 库
- 将文字效果应用于新创建或现有文字
- 配置 发光 对象,并将其赋值给 文本效果 反对
- 将其分配给 文本效果 属性
- 将编辑过的 Word 文档导出为新文件
安装使用 NuGet
Install-Package IronWord
开始在您的项目中使用IronPDF,并立即获取免费试用。
查看 IronWord 上 Nuget 用于快速安装和部署。它有超过800万次下载,正在使用C#改变。
Install-Package IronWord
Add Glow Effect
要指定文字的辉光效果,可以先创建并配置Glow对象。然后,从该 Glow 对象创建TextEffect对象。最后,将 TextEffect 赋值给文本的 TextEffect 属性。
:path=/static-assets/word/content-code-examples/how-to/text-effect-glow-effect.cs
using IronWord;
using IronWord.Models;
// Create new Word document
WordDocument doc = new WordDocument();
// Create and configure text style
TextStyle textStyle = new TextStyle();
textStyle.TextEffect = new TextEffect()
{
GlowEffect = new Glow()
{
GlowColor = IronWord.Models.Color.Aqua,
GlowRadius = 10,
},
};
// Add text with style
doc.AddText("Hello World").Style = textStyle;
// Export new Word document
doc.SaveAs("glowEffect.docx");
Imports IronWord
Imports IronWord.Models
' Create new Word document
Private doc As New WordDocument()
' Create and configure text style
Private textStyle As New TextStyle()
textStyle.TextEffect = New TextEffect() With {
.GlowEffect = New Glow() With {
.GlowColor = IronWord.Models.Color.Aqua,
.GlowRadius = 10
}
}
' Add text with style
doc.AddText("Hello World").Style = textStyle
' Export new Word document
doc.SaveAs("glowEffect.docx")
闪光效果属性
以下是所有辉光效果属性及其说明:
- GlowRadius :获取或设置辉光效果的半径。发光半径的单位是点 (1/72 英寸).
- GlowColor :获取或设置发光效果的颜色。
辉光效果示例
让我们来看看更多的辉光效果示例。辉光效果的颜色也可以接受 ARGB 值。第一个值是 alpha 值,用于描述颜色的不透明程度。