テキストに反射効果を加える方法
テキストのリフレクション効果とは、テキストを元の形よりも下に鏡のように映し出す視覚的強調効果です。 このエフェクトは、表面上の文字の反射をシミュレートし、しばしばデザインに深みとリアリズムを加える。
IronWordの使用を開始する
今日から無料トライアルでIronWordをあなたのプロジェクトで使い始めましょう。
テキストに反射効果を加える方法
- テキストにリフレクションを追加するC#(シーシャープ)ライブラリのダウンロード
- 新規作成または既存のテキストにテキスト効果を適用します。
- をインスタンス化して、プリセットの反射エフェクトを適用する。 リフレクション クラス
- 構成する リフレクション カスタマイズされたテキストアウトラインを実現するプロパティ
- 編集したWord文書を新規ファイルとして書き出す
反射効果の追加
テキストの反射効果を指定するには、TextStyle オブジェクトを作成し、ReflectionEffect プロパティに Reflection オブジェクトを指定します。 最後に、TextEffectプロパティにTextStyleオブジェクトを代入して、スタイルを持つ新しいテキストを追加します。
:path=/static-assets/word/content-code-examples/how-to/text-effect-reflection-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()
{
ReflectionEffect = new Reflection(),
};
// Add text with style
doc.AddText("Hello World").Style = textStyle;
// Export new Word document
doc.SaveAs("reflectionEffect.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 {.ReflectionEffect = New Reflection()}
' Add text with style
doc.AddText("Hello World").Style = textStyle
' Export new Word document
doc.SaveAs("reflectionEffect.docx")
反射効果のプロパティ
リフレクション・エフェクトは、多様な設計要件を満たすために、さまざまな調整可能な属性を提供する。 各物件の詳細については、以下のリストを参照のこと:
- SchemeColor:反射効果のスキームカラーを取得または設定します。
- HorizontalSkewAngle:反射効果の水平スキュー角度を取得または設定します。 スキュー角は度単位で指定する。
- HorizontalScalingFactor:反射効果の水平方向のスケーリング係数を取得または設定します。
- DistanceFromText:テキストまたはオブジェクトからの反射効果の距離を取得または設定します。 距離はポイントで指定する。(1/72インチ).
- DirectionAngle:反射エフェクトの方向角度を取得または設定します。 方向角度は度単位で指定する。
- FadeDirectionAngle:反射エフェクトのフェード方向を取得または設定します。
- EndPosition:反射エフェクトの終了位置を取得または設定します。
- StartPosition:反射エフェクトの開始位置を取得または設定します。
- EndingOpacity:反射効果の終了不透明度を取得または設定します。
- VerticalScalingFactor:反射効果の垂直方向のスケーリング係数を取得または設定します。
- StartingOpacity:反射効果の開始不透明度を取得または設定します。
- Alignment:反射エフェクトのアライメントを取得または設定します。
- BlurRadius:反射効果のぼかし半径を取得または設定します。 ぼかしの半径をポイントで指定します。(1/72インチ).
- VerticalSkewAngle:反射エフェクトの垂直スキュー角度を取得または設定します。 スキュー角は度単位で指定する。
:path=/static-assets/word/content-code-examples/how-to/text-effect-customized-reflection-effect.cs
using IronWord;
using IronWord.Models;
using IronWord.Models.Enums;
// Create new Word document
WordDocument doc = new WordDocument();
// Create and configure text style
TextStyle textStyle = new TextStyle();
textStyle.TextEffect = new TextEffect()
{
ReflectionEffect = new Reflection()
{
Alignment = RectangleAlignmentValues.BottomLeft,
BlurRadius = 5,
DirectionAngle = 90,
DistanceFromText = 5,
EndingOpacity = 100,
EndPosition = 10,
FadeDirectionAngle = 90,
HorizontalScalingFactor = 100,
HorizontalSkewAngle = 0,
SchemeColor = IronWord.Models.Color.Gold,
StartingOpacity = 0,
StartPosition = 0,
VerticalScalingFactor = -100,
VerticalSkewAngle = 0,
},
};
// Add text with style
doc.AddText("Customized reflection").Style = textStyle;
// Export new Word document
doc.SaveAs("customizedReflectionEffect.docx");
Imports IronWord
Imports IronWord.Models
Imports IronWord.Models.Enums
' Create new Word document
Private doc As New WordDocument()
' Create and configure text style
Private textStyle As New TextStyle()
textStyle.TextEffect = New TextEffect() With {
.ReflectionEffect = New Reflection() With {
.Alignment = RectangleAlignmentValues.BottomLeft,
.BlurRadius = 5,
.DirectionAngle = 90,
.DistanceFromText = 5,
.EndingOpacity = 100,
.EndPosition = 10,
.FadeDirectionAngle = 90,
.HorizontalScalingFactor = 100,
.HorizontalSkewAngle = 0,
.SchemeColor = IronWord.Models.Color.Gold,
.StartingOpacity = 0,
.StartPosition = 0,
.VerticalScalingFactor = -100,
.VerticalSkewAngle = 0
}
}
' Add text with style
doc.AddText("Customized reflection").Style = textStyle
' Export new Word document
doc.SaveAs("customizedReflectionEffect.docx")