Aspose::Words::Drawing::Fill class

Fill class

Represents fill formatting for an object. To learn more, visit the Working with Graphic Elements documentation article.

class Fill : public System::Object

Methods

MethodDescription
get_BackColor()Gets or sets a Color object that represents the background color for the fill.
get_BackThemeColor()Gets or sets a ThemeColor object that represents the background color for the fill.
get_BackTintAndShade()Gets or sets a double value that lightens or darkens the background color.
get_BaseForeColor()Gets a Color object that represents the base foreground color for the fill without any modifiers.
get_Color()Gets or sets a Color object that represents the foreground color for the fill.
get_FillType()Gets a fill type.
get_ForeColor()Gets a Color object that represents the foreground color for the fill.
get_ForeThemeColor()Gets or sets a ThemeColor object that represents the foreground color for the fill.
get_ForeTintAndShade()Gets or sets a double value that lightens or darkens the foreground color.
get_GradientAngle()Gets or sets the angle of the gradient fill.
get_GradientStops()Gets a collection of GradientStop objects for the fill.
get_GradientStyle()Gets the gradient style GradientStyle for the fill.
get_GradientVariant()Gets the gradient variant GradientVariant for the fill.
get_ImageBytes()Gets the raw bytes of the fill texture or pattern.
get_Opacity()Gets or sets the degree of opacity of the specified fill as a value between 0.0 (clear) and 1.0 (opaque).
get_Pattern()Gets a PatternType for the fill.
get_PresetTexture()Gets a PresetTexture for the fill.
get_RotateWithObject()Gets whether the fill rotates with the specified object.
get_TextureAlignment()Gets or sets the alignment for tile texture fill.
get_Transparency()Gets or sets the degree of transparency of the specified fill as a value between 0.0 (opaque) and 1.0 (clear).
get_Visible()Gets value that is true if the formatting applied to this instance, is visible.
GetType() const override
Is(const System::TypeInfo&) const override
OneColorGradient(Aspose::Words::Drawing::GradientStyle, Aspose::Words::Drawing::GradientVariant, double)Sets the specified fill to a one-color gradient.
OneColorGradient(System::Drawing::Color, Aspose::Words::Drawing::GradientStyle, Aspose::Words::Drawing::GradientVariant, double)Sets the specified fill to a one-color gradient using the specified color.
Patterned(Aspose::Words::Drawing::PatternType)Sets the specified fill to a pattern.
Patterned(Aspose::Words::Drawing::PatternType, System::Drawing::Color, System::Drawing::Color)Sets the specified fill to a pattern.
PresetTextured(Aspose::Words::Drawing::PresetTexture)Sets the fill to a preset texture.
set_BackColor(System::Drawing::Color)Setter for Aspose::Words::Drawing::Fill::get_BackColor.
set_BackThemeColor(Aspose::Words::Themes::ThemeColor)Setter for Aspose::Words::Drawing::Fill::get_BackThemeColor.
set_BackTintAndShade(double)Setter for Aspose::Words::Drawing::Fill::get_BackTintAndShade.
set_Color(System::Drawing::Color)Setter for Aspose::Words::Drawing::Fill::get_Color.
set_ForeColor(System::Drawing::Color)Sets a Color object that represents the foreground color for the fill.
set_ForeThemeColor(Aspose::Words::Themes::ThemeColor)Setter for Aspose::Words::Drawing::Fill::get_ForeThemeColor.
set_ForeTintAndShade(double)Setter for Aspose::Words::Drawing::Fill::get_ForeTintAndShade.
set_GradientAngle(double)Setter for Aspose::Words::Drawing::Fill::get_GradientAngle.
set_Opacity(double)Setter for Aspose::Words::Drawing::Fill::get_Opacity.
set_RotateWithObject(bool)Sets whether the fill rotates with the specified object.
set_TextureAlignment(Aspose::Words::Drawing::TextureAlignment)Setter for Aspose::Words::Drawing::Fill::get_TextureAlignment.
set_Transparency(double)Setter for Aspose::Words::Drawing::Fill::get_Transparency.
set_Visible(bool)Sets value that is true if the formatting applied to this instance, is visible.
SetImage(const System::String&)Changes the fill type to single image.
SetImage(const System::SharedPtr<System::IO::Stream>&)Changes the fill type to single image.
SetImage(const System::ArrayPtr<uint8_t>&)Changes the fill type to single image.
Solid()Sets the fill to a uniform color.
Solid(System::Drawing::Color)Sets the fill to a specified uniform color.
TwoColorGradient(Aspose::Words::Drawing::GradientStyle, Aspose::Words::Drawing::GradientVariant)Sets the specified fill to a two-color gradient.
TwoColorGradient(System::Drawing::Color, System::Drawing::Color, Aspose::Words::Drawing::GradientStyle, Aspose::Words::Drawing::GradientVariant)Sets the specified fill to a two-color gradient.
static Type()

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.

auto doc = System::MakeObject<Aspose::Words::Document>();
auto builder = System::MakeObject<Aspose::Words::DocumentBuilder>(doc);

// Write some text, and then cover it with a floating shape.
builder->get_Font()->set_Size(32);
builder->Writeln(u"Hello world!");

System::SharedPtr<Aspose::Words::Drawing::Shape> shape = builder->InsertShape(Aspose::Words::Drawing::ShapeType::CloudCallout, Aspose::Words::Drawing::RelativeHorizontalPosition::LeftMargin, 25, Aspose::Words::Drawing::RelativeVerticalPosition::TopMargin, 25, 250, 150, Aspose::Words::Drawing::WrapType::None);

// Use the "StrokeColor" property to set the color of the outline of the shape.
shape->set_StrokeColor(System::Drawing::Color::get_CadetBlue());

// Use the "FillColor" property to set the color of the inside area of the shape.
shape->set_FillColor(System::Drawing::Color::get_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.
ASPOSE_ASSERT_EQ(1.0, shape->get_Fill()->get_Opacity());

// Set the shape fill color's opacity to a lower value so that we can see the text underneath it.
shape->get_Fill()->set_Opacity(0.3);

doc->Save(get_ArtifactsDir() + u"Shape.Fill.docx");

See Also