Class Effect3D
Represents a 3D effect applied to an object or text in a Word document.
Inheritance
Namespace: IronWord.Models
Assembly: IronWord.dll
Syntax
public class Effect3D : Object
When an object or text in a Word document needs depth, Effect3D supplies the 3D treatment. It bundles the bevel, contour, extrusion, and material settings that give a flat element a raised, carved, or glossy appearance, which a developer attaches where a document element accepts a 3D effect.
The quickest start is the static DefaultEffect, a predefined Effect3D ready to apply without setting anything. For a custom effect, construct one with new Effect3D() and configure its parts. BevelTop and BevelBottom take Bevel objects that shape the raised edges, ContourColor and ExtrusionColor (both Color) set the outline and depth colors, and PresetMaterialType chooses a surface finish from PresetMaterialTypeValues, such as matte or metallic.
The depth measurements have paired getters and setters that work in a chosen unit. SetContourWidth and SetExtrusionHeight each take a value and a MeasurementUnit, while GetContourWidth and GetExtrusionHeight return the current value converted to a requested unit, so a developer can set the contour width in points and read it back in millimeters without doing the math. The ContourWidth and ExtrusionHeight properties hold the underlying double values directly when a unit conversion is not needed. Because all of these settings live on one effect object, the same Effect3D can be defined once and reused across several elements that should share the same look.
var effect = new Effect3D();
effect.PresetMaterialType = PresetMaterialTypeValues.Matte;
effect.SetExtrusionHeight(6, MeasurementUnit.Point);The shadow text effect how-to applies a related depth effect, the glow text effect how-to covers another visual treatment, and the document element tutorial shows how effects attach to elements.
Constructors
Effect3D()
Create a 3D effect instance.
Declaration
public Effect3D()
Fields
DefaultEffect
Create a predefined 3D effect instance.
Declaration
public static Effect3D DefaultEffect
Field Value
| Type | Description |
|---|---|
| Effect3D |
Properties
BevelBottom
Gets or sets the bevel effect applied to the bottom of the object or text.
Declaration
public Bevel BevelBottom { get; set; }
Property Value
| Type | Description |
|---|---|
| Bevel |
BevelTop
Gets or sets the bevel effect applied to the top of the object or text.
Declaration
public Bevel BevelTop { get; set; }
Property Value
| Type | Description |
|---|---|
| Bevel |
ContourColor
Gets or sets the color of the contour effect.
Declaration
public Color ContourColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
ContourWidth
Gets or sets the width of the contour effect.
Declaration
public double ContourWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
The width is specified in points (1/72 inch).
ExtrusionColor
Gets or sets the color of the extrusion effect.
Declaration
public Color ExtrusionColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
ExtrusionHeight
Gets or sets the height of the extrusion effect.
Declaration
public double ExtrusionHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
The height is specified in points (1/72 inch).
PresetMaterialType
Gets or sets the preset material type for the 3D effect.
Declaration
public PresetMaterialTypeValues PresetMaterialType { get; set; }
Property Value
| Type | Description |
|---|---|
| PresetMaterialTypeValues |
Methods
GetContourWidth(MeasurementUnit)
Gets the width of the contour effect in the specified measurement unit.
Declaration
public double GetContourWidth(MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| MeasurementUnit | measurementUnit | The measurement unit to convert the width to. |
Returns
| Type | Description |
|---|---|
| System.Double | The width of the contour effect. |
GetExtrusionHeight(MeasurementUnit)
Gets the height of the extrusion effect in the specified measurement unit.
Declaration
public double GetExtrusionHeight(MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| MeasurementUnit | measurementUnit | The measurement unit to convert the height to. |
Returns
| Type | Description |
|---|---|
| System.Double | The height of the extrusion effect. |
SetContourWidth(Double, MeasurementUnit)
Sets the width of the contour effect to the specified value in the specified measurement unit.
Declaration
public void SetContourWidth(double contourWidth, MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | contourWidth | The width of the contour effect. |
| MeasurementUnit | measurementUnit | The measurement unit of the specified width. |
SetExtrusionHeight(Double, MeasurementUnit)
Sets the height of the extrusion effect to the specified value in the specified measurement unit.
Declaration
public void SetExtrusionHeight(double height, MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | height | The height of the extrusion effect. |
| MeasurementUnit | measurementUnit | The measurement unit of the specified height. |