C#でテキストに光彩効果を追加する方法

How to Add Glow Effect to Text

This article was translated from English: Does it need improvement?
Translated
View the article in English

テキスト上のグロー効果は、文字の周りに輝くオーラを作り出す視覚効果です。 この効果により、テキストは光を放っているように見え、読みやすさを向上させたり注目を集めたりするソフトで明るい輪郭が作成されます。

クイックスタート: テキスト要素にグロー効果をすばやく適用する

グローオブジェクトをインスタンス化し、その半径と色を設定し、TextEffectに組み込み、テキストのスタイルに割り当てます。 1行でWord文書にグロー効果があるテキストが表示されます。

Nuget IconGet started making PDFs with NuGet now:

  1. Install IronWord with NuGet Package Manager

    PM > Install-Package IronWord

  2. Copy and run this code snippet.

    someTextElement.Style.TextEffect = new IronWord.Models.TextEffect { GlowEffect = new IronWord.Models.Glow { GlowRadius = 8, GlowColor = System.Drawing.Color.FromArgb(180, 0, 128, 255) } };
  3. Deploy to test on your live environment

    Start using IronWord in your project today with a free trial
    arrow pointer

IronWordを使い始める

今日あなたのプロジェクトでIronWordを無料トライアルで使用開始。

最初のステップ:
green arrow pointer

class="hsg-featured-snippet">

最少ワークフロー (5 ステップ)

  1. C# ライブラリをダウンロードして、テキストにグロー効果を追加する
  2. 作成済みまたは既存のテキストにテキスト効果を適用する
  3. Glow オブジェクトを構成し TextEffect オブジェクトに割り当てる
  4. TextEffect プロパティに割り当てる
  5. 編集したWord文書を新しいファイルとしてエクスポートする

グロー効果を追加する

テキストのグロー効果を指定するには、まず Glow オブジェクトを作成して構成することから始めます。 次に、このグローオブジェクトから TextEffect オブジェクトを作成します。 最後に、TextEffectをテキストのTextEffectプロパティに割り当てます。

using IronWord; // Import the necessary library

public class TextGlowEffectExample
{
    public void ApplyGlowEffect()
    {
        // Initialize a new Glow object
        Glow glow = new Glow();

        // Set the properties for the glow effect
        glow.GlowRadius = 5; // Radius of the glow effect
        glow.GlowColor = System.Drawing.Color.FromArgb(128, 255, 0, 0); // ARGB value for the glow color

        // Create a TextEffect object and assign the glow effect to it
        TextEffect textEffect = new TextEffect();
        textEffect.Glow = glow;

        // Apply the TextEffect to the text
        // Example: someTextElement.TextEffect = textEffect;

        // Further code to export or display the document would go here
    }
}
using IronWord; // Import the necessary library

public class TextGlowEffectExample
{
    public void ApplyGlowEffect()
    {
        // Initialize a new Glow object
        Glow glow = new Glow();

        // Set the properties for the glow effect
        glow.GlowRadius = 5; // Radius of the glow effect
        glow.GlowColor = System.Drawing.Color.FromArgb(128, 255, 0, 0); // ARGB value for the glow color

        // Create a TextEffect object and assign the glow effect to it
        TextEffect textEffect = new TextEffect();
        textEffect.Glow = glow;

        // Apply the TextEffect to the text
        // Example: someTextElement.TextEffect = textEffect;

        // Further code to export or display the document would go here
    }
}
Imports IronWord ' Import the necessary library

Public Class TextGlowEffectExample
	Public Sub ApplyGlowEffect()
		' Initialize a new Glow object
		Dim glow As New Glow()

		' Set the properties for the glow effect
		glow.GlowRadius = 5 ' Radius of the glow effect
		glow.GlowColor = System.Drawing.Color.FromArgb(128, 255, 0, 0) ' ARGB value for the glow color

		' Create a TextEffect object and assign the glow effect to it
		Dim textEffect As New TextEffect()
		textEffect.Glow = glow

		' Apply the TextEffect to the text
		' Example: someTextElement.TextEffect = textEffect;

		' Further code to export or display the document would go here
	End Sub
End Class
$vbLabelText   $csharpLabel
class="content-img-align-center">
class="center-image-wrapper"> グロー効果を追加する

グロー効果のプロパティ

以下に、すべてのグロー効果プロパティとその説明を示します:

  • GlowRadius: グロー効果の半径を取得または設定します。 グロー半径はポイント (1/72 インチ) で指定されます。
  • GlowColor: グロー効果の色を取得または設定します。

グロー効果の例

いくつかのグロー効果の例を見てみましょう。 グロー効果の色はARGB値も受け入れることができます。 最初の値はアルファで、色の不透明度を説明します。

class="content-img-align-center">
class="center-image-wrapper"> グロー効果の例

よくある質問

Word文書のテキストにグロー効果を追加するにはどうすればよいですか?

Wordドキュメントのテキストにグロー効果を追加するには、その目的のために設計されたC#ライブラリを使用します。Glowオブジェクトを初期化し、そのプロパティ(GlowRadiusGlowColorなど)を設定し、TextEffectオブジェクトに割り当てます。最後に、このTextEffectをテキストに適用し、ドキュメントをエクスポートします。

C#を使用してテキストにグロー効果を適用するために必要なコードは何ですか?

必要なライブラリをインポートし、望ましいプロパティを持つGlowオブジェクトを作成することで、グロー効果を適用できます。これをTextEffectオブジェクトに割り当て、テキストに適用します。

テキスト編集におけるグロー効果の主要なプロパティは何ですか?

グロー効果の主要なプロパティは、ポイントでグローの半径を設定するGlowRadiusと、グローの色を定義するGlowColorです。これらのプロパティは、グロー効果の外観をカスタマイズするために設定できます。

グローの色をARGB値でカスタマイズすることはできますか?

はい、グローの色はARGB値を使用してカスタマイズできます。ARGBのアルファ値はグローの不透明度を決定し、色のカスタマイズの幅広い範囲を可能にします。

グロー効果を適用した後にWord文書をエクスポートするにはどうすればよいですか?

C#ライブラリを使用してグロー効果を適用した後、編集したWord文書をエクスポートし、ライブラリが提供する適切な方法を呼び出して、新しいファイルとしてドキュメントを保存または表示します。

新しいテキストと既存のテキストの両方にグロー効果を適用することは可能ですか?

はい、Wordドキュメント内の新しく作成したテキストと既存のテキストの両方にグロー効果を適用できます。この柔軟性により、ドキュメント内の任意のテキスト要素を強調できるようになります。

GlowRadiusプロパティの目的は何ですか?

GlowRadiusプロパティは、グロー効果がテキストからどの程度拡張されるかを決定するポイントでのグロー効果の半径を指定します。半径はポイントで定義されており、1ポイントは1/72インチに相当します。

C#でグロー効果を設定するために必要な手順は何ですか?

C#でグロー効果を設定するには、Glowオブジェクトを初期化し、そのGlowRadiusおよびGlowColorプロパティを設定して、TextEffectオブジェクトに割り当てます。TextEffectをテキストに適用して、ドキュメントをエクスポートすると変更が反映されます。

Curtis Chau
テクニカルライター

Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。

開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。

準備はいいですか?
Nuget ダウンロード 25,807 | バージョン: 2025.11 ただ今リリースされました