How to Add Glow Effect to Text in C
グロー効果により、テキスト文字の周囲に光り輝くオーラが生まれます。 この視覚効果により、テキストはソフトなアウトラインで発光しているように見えます。C#アプリケーション、特にWord文書では、グロー効果はヘッダー、タイトル、重要なコンテンツを強調するのに役立ちます。 この効果は、プレゼンテーション、マーケティング資料、およびテキストを視覚的に強調する必要があるProfessional文書で広く使用されています。
クイックスタート: テキスト要素にグロー効果を素早く適用する
TextEffectに埋め込み、テキストのスタイルに割り当てます。 1行でWord文書に光るテキストを作成します。
-
IronWord をNuGetパッケージマネージャでインストール
PM > Install-Package IronWord -
このコード スニペットをコピーして実行します。
using IronWord; using IronWord.Models; WordDocument doc = new WordDocument(); TextStyle textStyle = new TextStyle(); textStyle.TextEffect = new TextEffect() { GlowEffect = new Glow() { GlowColor = IronWord.Models.Color.Aqua, GlowRadius = 10 } }; Paragraph paragraph = new Paragraph(); Run textRun = new Run(new TextContent("Glowing Text")); textRun.Style = textStyle; paragraph.AddChild(textRun); doc.AddParagraph(paragraph); doc.SaveAs("glow.docx"); -
実際の環境でテストするためにデプロイする
今日プロジェクトで IronWord を使い始めましょう無料トライアル
テキストにグロー効果を追加する方法(5つのステップ)
- IronWordをインストール:
Install-Package IronWord TextStyleを作成し、GlowColorとGlowRadiusを使用してGlowEffectを設定します。TextContentを含むRunを作成し、そのRunにTextStyleを割り当てます。AddChildを使用してParagraphにRunを追加する- 文書を保存する
C#でテキストにグロー効果を追加するには?
光彩効果を適用するには、GlowEffectを設定します。 その後、TextContentを含めます。 Paragraphに追加します。 これは、ドキュメント階層に従います: ドキュメント → 段落 → 実行 → TextContent。 このアプローチでは、グローの外観と強度を完全に制御できます。
なぜ Glow オブジェクトを最初に作成することが重要なのですか?
最初にGlowオブジェクトを作成することで、適用前にすべての光彩プロパティを構成できます。 これは、懸念事項の分離の原則に従い、コードの保守性を向上させます。 グローのプロパティを個別に定義することで、複数のテキスト要素での再利用や、アプリケーションの要件に基づく動的な変更が可能になります。 このパターンは、他のIron Software製品が同じような効果をどのように処理するかと一致し、文書処理ワークフローの一貫性を維持します。
using IronWord;
using IronWord.Models;
using System.Drawing;
public class TextGlowEffectExample
{
public void ApplyGlowEffect()
{
// Create a new Word document
WordDocument doc = new WordDocument();
// Add a paragraph with text
Paragraph paragraph = new Paragraph();
Text textRun = new Text("This text has a bright glow!");
paragraph.AddTextRun(textRun);
// Initialize a new Glow object
Glow glow = new Glow();
// Set the properties for the glow effect
glow.GlowRadius = 15; // Radius of the glow effect in points
glow.GlowColor = Color.FromArgb(200, 0, 255, 255); // Semi-transparent cyan
// Create a TextEffect object and assign the glow effect to it
TextEffect textEffect = new TextEffect();
textEffect.GlowEffect = glow;
// Apply the TextEffect to the text
textRun.Style = new TextStyle();
textRun.Style.TextEffect = textEffect;
// Add the paragraph to the document
doc.AddParagraph(paragraph);
// 文書を保存する
doc.SaveAs("glowing-text-example.docx");
}
}
using IronWord;
using IronWord.Models;
using System.Drawing;
public class TextGlowEffectExample
{
public void ApplyGlowEffect()
{
// Create a new Word document
WordDocument doc = new WordDocument();
// Add a paragraph with text
Paragraph paragraph = new Paragraph();
Text textRun = new Text("This text has a bright glow!");
paragraph.AddTextRun(textRun);
// Initialize a new Glow object
Glow glow = new Glow();
// Set the properties for the glow effect
glow.GlowRadius = 15; // Radius of the glow effect in points
glow.GlowColor = Color.FromArgb(200, 0, 255, 255); // Semi-transparent cyan
// Create a TextEffect object and assign the glow effect to it
TextEffect textEffect = new TextEffect();
textEffect.GlowEffect = glow;
// Apply the TextEffect to the text
textRun.Style = new TextStyle();
textRun.Style.TextEffect = textEffect;
// Add the paragraph to the document
doc.AddParagraph(paragraph);
// 文書を保存する
doc.SaveAs("glowing-text-example.docx");
}
}
Imports IronWord
Imports IronWord.Models
Imports System.Drawing
Public Class TextGlowEffectExample
Public Sub ApplyGlowEffect()
' Create a new Word document
Dim doc As New WordDocument()
' Add a paragraph with text
Dim paragraph As New Paragraph()
Dim textRun As New Text("This text has a bright glow!")
paragraph.AddTextRun(textRun)
' Initialize a new Glow object
Dim glow As New Glow()
' Set the properties for the glow effect
glow.GlowRadius = 15 ' Radius of the glow effect in points
glow.GlowColor = Color.FromArgb(200, 0, 255, 255) ' Semi-transparent cyan
' Create a TextEffect object and assign the glow effect to it
Dim textEffect As New TextEffect()
textEffect.GlowEffect = glow
' Apply the TextEffect to the text
textRun.Style = New TextStyle()
textRun.Style.TextEffect = textEffect
' Add the paragraph to the document
doc.AddParagraph(paragraph)
' Save the document
doc.SaveAs("glowing-text-example.docx")
End Sub
End Class
グロー効果の特性は何ですか?
グロー効果のプロパティを理解することは、コンテンツを圧倒することなく、ドキュメントを向上させるプロフェッショナルなエフェクトを作成するために不可欠です。 適切なライセンスは、これらの機能が制限なく本番環境で動作することを保証します。
どのプロパティがグローの外観を制御しますか?
-
GlowRadius: 光彩効果の半径をポイント(1/72インチ)で設定します。 数値は通常5~30ポイントです。 値が大きいほど、拡散して広がるような輝きが得られます。 半径5~10ポイントで微妙なハイライトを作成; 20~30ポイントで劇的なハレーションを起こします。 GlowColor: 光彩効果の色を設定します。 透明度を制御するARGBを含むSystem.Drawing.Color値を受け入れます。 明るい色(シアン、イエロー、マゼンタ)が鮮やかな効果を生み出します; 濃い色は微妙な強調を提供します。
アルファ透過で色の値を設定するには?
アルファ透過は、背景に自然に溶け込むリアルなグロー効果を生み出します。 アルファ値の範囲は0(透明)から255(不透明)です。 以下は、アルファ値の違いを示す例です:
using IronWord;
using IronWord.Models;
using System.Drawing;
public class AlphaTransparencyExample
{
public void DemonstrateAlphaValues()
{
WordDocument doc = new WordDocument();
// Create multiple text samples with different alpha values
int[] alphaValues = { 50, 100, 150, 200, 255 };
foreach (int alpha in alphaValues)
{
Paragraph para = new Paragraph();
Text text = new Text($"Alpha: {alpha} - Glow Effect Sample");
// Create glow with specific alpha transparency
Glow glow = new Glow
{
GlowRadius = 12,
GlowColor = Color.FromArgb(alpha, 255, 215, 0) // Gold with varying transparency
};
// Apply the glow effect
TextEffect effect = new TextEffect { GlowEffect = glow };
text.Style = new TextStyle
{
TextEffect = effect,
FontSize = 24,
FontFamily = "Arial"
};
para.AddTextRun(text);
doc.AddParagraph(para);
}
doc.SaveAs("alpha-transparency-demo.docx");
}
}
using IronWord;
using IronWord.Models;
using System.Drawing;
public class AlphaTransparencyExample
{
public void DemonstrateAlphaValues()
{
WordDocument doc = new WordDocument();
// Create multiple text samples with different alpha values
int[] alphaValues = { 50, 100, 150, 200, 255 };
foreach (int alpha in alphaValues)
{
Paragraph para = new Paragraph();
Text text = new Text($"Alpha: {alpha} - Glow Effect Sample");
// Create glow with specific alpha transparency
Glow glow = new Glow
{
GlowRadius = 12,
GlowColor = Color.FromArgb(alpha, 255, 215, 0) // Gold with varying transparency
};
// Apply the glow effect
TextEffect effect = new TextEffect { GlowEffect = glow };
text.Style = new TextStyle
{
TextEffect = effect,
FontSize = 24,
FontFamily = "Arial"
};
para.AddTextRun(text);
doc.AddParagraph(para);
}
doc.SaveAs("alpha-transparency-demo.docx");
}
}
Imports IronWord
Imports IronWord.Models
Imports System.Drawing
Public Class AlphaTransparencyExample
Public Sub DemonstrateAlphaValues()
Dim doc As New WordDocument()
' Create multiple text samples with different alpha values
Dim alphaValues As Integer() = {50, 100, 150, 200, 255}
For Each alpha As Integer In alphaValues
Dim para As New Paragraph()
Dim text As New Text($"Alpha: {alpha} - Glow Effect Sample")
' Create glow with specific alpha transparency
Dim glow As New Glow With {
.GlowRadius = 12,
.GlowColor = Color.FromArgb(alpha, 255, 215, 0) ' Gold with varying transparency
}
' Apply the glow effect
Dim effect As New TextEffect With {.GlowEffect = glow}
text.Style = New TextStyle With {
.TextEffect = effect,
.FontSize = 24,
.FontFamily = "Arial"
}
para.AddTextRun(text)
doc.AddParagraph(para)
Next
doc.SaveAs("alpha-transparency-demo.docx")
End Sub
End Class
アルファ値のガイドライン
- 50-100:非常に微妙な、ほとんど見えない、透かし風の効果
- 100-150:ソフトな輝き、ビジネス文書のためのプロフェッショナルな外観。
- 150-200:ヘッダーとタイトルのバランスが取れた中程度の強さ
- 200-255:強い輝き、販促資料用の高いインパクト。
グロー効果の例をいくつか教えてください
グローエフェクトはARGBカラー値を受け入れます。 アルファ値は不透明度を制御します。 これらの例は、さまざまなドキュメントのコンテキストにおける実用的なグローアプリケーションを示しています。 本番導入の前に、適切なライセンスキーを設定してください。
どのような場合に異なる半径値を使用すべきですか?
半径の値が異なれば、目的も異なります。 小さな半径(5~10ポイント)は、用語やリンクを微妙に強調するために、焦点を絞ったグローを作成します。 セクションのヘッダーやタイトルには中半径(15~20ポイント)を使用し、明確な階層を提供します。 大きな半径(25ポイント以上)は、最大のインパクトを必要とする表紙や宣伝用の吹き出しに適しています。
以下は、RADIUSのアプリケーションを示す実装です:
public class RadiusExamples
{
public void CreateRadiusComparison()
{
WordDocument doc = new WordDocument();
// Example 1: Subtle emphasis for inline text
Paragraph p1 = new Paragraph();
Text subtleText = new Text("Important: This deadline cannot be extended.");
subtleText.Style = new TextStyle
{
TextEffect = new TextEffect
{
GlowEffect = new Glow
{
GlowRadius = 6,
GlowColor = Color.FromArgb(180, 255, 0, 0) // Soft red glow
}
}
};
p1.AddTextRun(subtleText);
// Example 2: Section header with medium glow
Paragraph p2 = new Paragraph();
Text headerText = new Text("Chapter 1: Getting Started");
headerText.Style = new TextStyle
{
FontSize = 28,
FontFamily = "Calibri",
TextEffect = new TextEffect
{
GlowEffect = new Glow
{
GlowRadius = 18,
GlowColor = Color.FromArgb(150, 0, 120, 215) // Corporate blue
}
}
};
p2.AddTextRun(headerText);
// Example 3: Promotional text with large glow
Paragraph p3 = new Paragraph();
Text promoText = new Text("SPECIAL OFFER - LIMITED TIME!");
promoText.Style = new TextStyle
{
FontSize = 36,
Bold = true,
TextEffect = new TextEffect
{
GlowEffect = new Glow
{
GlowRadius = 30,
GlowColor = Color.FromArgb(220, 255, 255, 0) // Bright yellow
}
}
};
p3.AddTextRun(promoText);
doc.AddParagraph(p1);
doc.AddParagraph(p2);
doc.AddParagraph(p3);
doc.SaveAs("radius-examples.docx");
}
}
public class RadiusExamples
{
public void CreateRadiusComparison()
{
WordDocument doc = new WordDocument();
// Example 1: Subtle emphasis for inline text
Paragraph p1 = new Paragraph();
Text subtleText = new Text("Important: This deadline cannot be extended.");
subtleText.Style = new TextStyle
{
TextEffect = new TextEffect
{
GlowEffect = new Glow
{
GlowRadius = 6,
GlowColor = Color.FromArgb(180, 255, 0, 0) // Soft red glow
}
}
};
p1.AddTextRun(subtleText);
// Example 2: Section header with medium glow
Paragraph p2 = new Paragraph();
Text headerText = new Text("Chapter 1: Getting Started");
headerText.Style = new TextStyle
{
FontSize = 28,
FontFamily = "Calibri",
TextEffect = new TextEffect
{
GlowEffect = new Glow
{
GlowRadius = 18,
GlowColor = Color.FromArgb(150, 0, 120, 215) // Corporate blue
}
}
};
p2.AddTextRun(headerText);
// Example 3: Promotional text with large glow
Paragraph p3 = new Paragraph();
Text promoText = new Text("SPECIAL OFFER - LIMITED TIME!");
promoText.Style = new TextStyle
{
FontSize = 36,
Bold = true,
TextEffect = new TextEffect
{
GlowEffect = new Glow
{
GlowRadius = 30,
GlowColor = Color.FromArgb(220, 255, 255, 0) // Bright yellow
}
}
};
p3.AddTextRun(promoText);
doc.AddParagraph(p1);
doc.AddParagraph(p2);
doc.AddParagraph(p3);
doc.SaveAs("radius-examples.docx");
}
}
Public Class RadiusExamples
Public Sub CreateRadiusComparison()
Dim doc As New WordDocument()
' Example 1: Subtle emphasis for inline text
Dim p1 As New Paragraph()
Dim subtleText As New Text("Important: This deadline cannot be extended.")
subtleText.Style = New TextStyle With {
.TextEffect = New TextEffect With {
.GlowEffect = New Glow With {
.GlowRadius = 6,
.GlowColor = Color.FromArgb(180, 255, 0, 0) ' Soft red glow
}
}
}
p1.AddTextRun(subtleText)
' Example 2: Section header with medium glow
Dim p2 As New Paragraph()
Dim headerText As New Text("Chapter 1: Getting Started")
headerText.Style = New TextStyle With {
.FontSize = 28,
.FontFamily = "Calibri",
.TextEffect = New TextEffect With {
.GlowEffect = New Glow With {
.GlowRadius = 18,
.GlowColor = Color.FromArgb(150, 0, 120, 215) ' Corporate blue
}
}
}
p2.AddTextRun(headerText)
' Example 3: Promotional text with large glow
Dim p3 As New Paragraph()
Dim promoText As New Text("SPECIAL OFFER - LIMITED TIME!")
promoText.Style = New TextStyle With {
.FontSize = 36,
.Bold = True,
.TextEffect = New TextEffect With {
.GlowEffect = New Glow With {
.GlowRadius = 30,
.GlowColor = Color.FromArgb(220, 255, 255, 0) ' Bright yellow
}
}
}
p3.AddTextRun(promoText)
doc.AddParagraph(p1)
doc.AddParagraph(p2)
doc.AddParagraph(p3)
doc.SaveAs("radius-examples.docx")
End Sub
End Class
グロー効果のための一般的な色の組み合わせは何ですか?
効果的な色の組み合わせは、文書の目的やブランディングによって異なります。 プロフェッショナルな文書には、微妙なブルー、グレー、またはアルファ値の低いブランドカラーを使用します。 マーケティング資料には、鮮やかな補色や高コントラストの組み合わせを使用します。 複数のIron Software製品を使用する場合は、製品アップデートをチェックして互換性を確認してください。
一般的な色の組み合わせ
1.プロフェッショナルブルー:水色に輝くネイビーのテキスト(RGB:100、150、255) 2.温かみのある強調:黄金色に輝くこげ茶色のテキスト (RGB: 255, 200, 50) 3.ハイコントラスト: 白/銀の輝きを持つ黒文字 (RGB: 220, 220, 220) 4.ブランドカラー:補色の輝きを持つ会社色のテキスト 5.季節のテーマ:祝日の緑/赤、ハロウィンのオレンジ/黒
グロー効果は、可読性を高めるものであり、妨げになるものであってはなりません。 異なる背景で組み合わせをテストし、アクセシビリティ・ガイドラインに従ってください。 拡張サポートが必要なエンタープライズアプリケーションについては、licensing extensions を検索して、継続的な更新と機能を確認してください。 アプリケーションを拡張する場合、アップグレードオプションは、チームの成長や要件の拡大に柔軟に対応します。
よくある質問
C# を使用して Word 文書のテキストにグロー効果を追加するにはどうすればよいですか?
IronWordを使用してグロー効果を追加するには、希望の半径と色設定でグロー・オブジェクトを作成し、それをTextEffectオブジェクトに埋め込み、テキスト要素のStyle.TextEffectプロパティに割り当てます。これは一行で行うことができます: someTextElement.Style.TextEffect = new IronWord.Models.TextEffect { GlowEffect = new IronWord.Models.Glow { GlowRadius = 8, GlowColor = System.Drawing.Color.FromArgb(180, 0, 128, 255) }.};
光るテキストを作成するために最低限必要なコードは何ですか?
IronWordでは、テキスト要素のStyle.TextEffectプロパティに、設定されたグロー・オブジェクトを含む新しいTextEffectを設定することで、たった1行のコードでグロー・テキストを作成することができます。これには、グローの半径と色の設定も含まれます。
グロー効果の外観をカスタマイズできますか?
はい、IronWordはGlowオブジェクト・プロパティを通してグロー効果を完全にカスタマイズすることができます。また、System.Drawing.Colorを使用してGlowColorをARGB値で設定し、正確な色と透明度を制御することができます。
なぜインライン設定ではなく、個別のGlowオブジェクトを作成する必要があるのですか?
IronWordで個別のGlowオブジェクトを作成することは、関係分離の原則に従い、コードの保守性を向上させます。このアプローチにより、複数のテキスト要素で同じグローの設定を再利用し、アプリケーションの要件に基づいて動的にプロパティを変更することができます。
テキストにグロー効果を適用する主な手順は?
IronWordのワークフローには5つのステップがあります:1) IronWord C#ライブラリをダウンロード、2) 新規または既存のテキストにテキスト効果を適用、3) Glowオブジェクトを半径と色で設定、4) GlowをTextEffectオブジェクトのGlowEffectプロパティに割り当て、5) 編集したWord文書を新規ファイルとしてエクスポート。
テキストグロー効果はどのような文書に有効ですか?
IronWordのグロー効果機能は、プレゼンテーション、マーケティング資料、テキストを視覚的に強調する必要があるプロフェッショナルな文書の作成に特に役立ちます。発光するオーラ効果は、Word文書のヘッダー、タイトル、重要なコンテンツを強調するのに役立ちます。

