VegaRise.NET
HomeAPI Reference
Back to DOM

FillClass

Definition

Namespace
DOM.Elements.Graphics.Colors
Assembly
DOM.dll

Represents a fill (solid, gradient, pattern, or picture/texture) that can be applied to a shape, cell, or other fillable element.

Remarks

is the top-level fill container used by shapes and other graphical elements. Exactly one of the four fill types is expected to be set at a time; when multiple are configured, the consumer should apply a documented precedence rule (typically solid, then gradient, then pattern, then picture/texture). Fill Fills are attached to a shape via or to a table/cell through the respective style's shading property. Shape.Fill

Examples

csharp
1// 1. Solid fill
2var fill = new Fill { SolidFill = Color.LightBlue };
3
csharp
1// 2. Gradient fill
2var fill = new Fill
3{
4 GradientFill = new Gradient
5 {
6 GradientStops = new List<IGradientStop>
7 {
8 new GradientStop { StopColor = Color.Red, StopPosition = 0 },
9 new GradientStop { StopColor = Color.Yellow, StopPosition = 100 }
10 },
11 LinearShade = new LinearShade { Angle = 90 }
12 }
13};
14
csharp
1// 3. Pattern fill
2var fill = new Fill
3{
4 PatternFill = new PatternFill
5 {
6 ForegroundColor = Color.Black,
7 BackgroundColor = Color.White,
8 Pattern = PresetPatternValues.pct10
9 }
10};
11
csharp
1// 4. Picture/texture fill
2var fill = new Fill
3{
4 PictureOrTextureFill = new PictureOrTextureFill
5 {
6 Picture = new Image("texture.png"),
7 Transparency = new Percentage(20)
8 }
9};
10
csharp
1// 5. Attach to a shape
2var shape = new Shape { Type = ShapeType.Rectangle, Fill = fill };
3

Properties

GradientFillGradient

Gets or sets the gradient fill.

PatternFill

Gets or sets the pattern fill.

PictureOrTextureFill

Gets or sets the picture or texture fill.

SolidFillColor

Gets or sets the solid color fill.