Fill
Contents
[
Hide
]Fill class
Represents fill formatting for an object.
To learn more, visit the Working with Graphic Elements documentation article.
public class Fill
Properties
| Name | Description |
|---|---|
| BackColor { get; set; } | Gets or sets a Color object that represents the background color for the fill. |
| BackThemeColor { get; set; } | Gets or sets a ThemeColor object that represents the background color for the fill. |
| BackTintAndShade { get; set; } | Gets or sets a double value that lightens or darkens the background color. |
| BaseForeColor { get; } | Gets a Color object that represents the base foreground color for the fill without any modifiers. |
| Color { get; set; } | Gets or sets a Color object that represents the foreground color for the fill. |
| FillType { get; } | Gets a fill type. |
| ForeColor { get; set; } | Gets or sets a Color object that represents the foreground color for the fill. |
| ForeThemeColor { get; set; } | Gets or sets a ThemeColor object that represents the foreground color for the fill. |
| ForeTintAndShade { get; set; } | Gets or sets a double value that lightens or darkens the foreground color. |
| GradientAngle { get; set; } | Gets or sets the angle of the gradient fill. |
| GradientStops { get; } | Gets a collection of GradientStop objects for the fill. |
| GradientStyle { get; } | Gets the gradient style GradientStyle for the fill. |
| GradientVariant { get; } | Gets the gradient variant GradientVariant for the fill. |
| ImageBytes { get; } | Gets the raw bytes of the fill texture or pattern. |
| Opacity { get; set; } | Gets or sets the degree of opacity of the specified fill as a value between 0.0 (clear) and 1.0 (opaque). |
| Pattern { get; } | Gets a PatternType for the fill. |
| PresetTexture { get; } | Gets a PresetTexture for the fill. |
| RotateWithObject { get; set; } | Gets or sets whether the fill rotates with the specified object. |
| TextureAlignment { get; set; } | Gets or sets the alignment for tile texture fill. |
| Transparency { get; set; } | Gets or sets the degree of transparency of the specified fill as a value between 0.0 (opaque) and 1.0 (clear). |
| Visible { get; set; } | Gets or sets value that is true if the formatting applied to this instance, is visible. |
Methods
| Name | Description |
|---|---|
| OneColorGradient(GradientStyle, GradientVariant, double) | Sets the specified fill to a one-color gradient. |
| OneColorGradient(Color, GradientStyle, GradientVariant, double) | Sets the specified fill to a one-color gradient using the specified color. |
| Patterned(PatternType) | Sets the specified fill to a pattern. |
| Patterned(PatternType, Color, Color) | Sets the specified fill to a pattern. |
| PresetTextured(PresetTexture) | Sets the fill to a preset texture. |
| SetImage(byte[]) | Changes the fill type to single image. |
| SetImage(Stream) | Changes the fill type to single image. |
| SetImage(string) | Changes the fill type to single image. |
| Solid() | Sets the fill to a uniform color. |
| Solid(Color) | Sets the fill to a specified uniform color. |
| TwoColorGradient(GradientStyle, GradientVariant) | Sets the specified fill to a two-color gradient. |
| TwoColorGradient(Color, Color, GradientStyle, GradientVariant) | Sets the specified fill to a two-color gradient. |
Remarks
Use the Fill or Fill property to access fill properties of an object. You do not create instances of the Fill class directly.
Examples
Shows how to fill a shape with a solid color.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Write some text, and then cover it with a floating shape.
builder.Font.Size = 32;
builder.Writeln("Hello world!");
Shape shape = builder.InsertShape(ShapeType.CloudCallout, RelativeHorizontalPosition.LeftMargin, 25,
RelativeVerticalPosition.TopMargin, 25, 250, 150, WrapType.None);
// Use the "StrokeColor" property to set the color of the outline of the shape.
shape.StrokeColor = Color.CadetBlue;
// Use the "FillColor" property to set the color of the inside area of the shape.
shape.FillColor = Color.LightBlue;
// The "Opacity" property determines how transparent the color is on a 0-1 scale,
// with 1 being fully opaque, and 0 being invisible.
// The shape fill by default is fully opaque, so we cannot see the text that this shape is on top of.
Assert.That(shape.Fill.Opacity, Is.EqualTo(1.0d));
// Set the shape fill color's opacity to a lower value so that we can see the text underneath it.
shape.Fill.Opacity = 0.3;
doc.Save(ArtifactsDir + "Shape.Fill.docx");
See Also
- namespace Aspose.Words.Drawing
- assembly Aspose.Words