Aspose::Words::Drawing::Fill::Patterned method

Fill::Patterned(Aspose::Words::Drawing::PatternType) method

Sets the specified fill to a pattern.

void Aspose::Words::Drawing::Fill::Patterned(Aspose::Words::Drawing::PatternType patternType)
ParameterTypeDescription
patternTypeAspose::Words::Drawing::PatternTypePatternType

Examples

Shows how to set pattern for a shape.

auto doc = MakeObject<Document>(MyDir + u"Shape stroke pattern border.docx");

auto shape = System::ExplicitCast<Shape>(doc->GetChild(NodeType::Shape, 0, true));
SharedPtr<Fill> fill = shape->get_Fill();

std::cout << String::Format(u"Pattern value is: {0}", fill->get_Pattern()) << std::endl;

// There are several ways specified fill to a pattern.
// 1 -  Apply pattern to the shape fill:
fill->Patterned(PatternType::DiagonalBrick);

// 2 -  Apply pattern with foreground and background colors to the shape fill:
fill->Patterned(PatternType::DiagonalBrick, System::Drawing::Color::get_Aqua(), System::Drawing::Color::get_Bisque());

doc->Save(ArtifactsDir + u"Shape.FillPattern.docx");

See Also

Fill::Patterned(Aspose::Words::Drawing::PatternType, System::Drawing::Color, System::Drawing::Color) method

Sets the specified fill to a pattern.

void Aspose::Words::Drawing::Fill::Patterned(Aspose::Words::Drawing::PatternType patternType, System::Drawing::Color foreColor, System::Drawing::Color backColor)
ParameterTypeDescription
patternTypeAspose::Words::Drawing::PatternTypePatternType
foreColorSystem::Drawing::ColorThe color of the foreground fill.
backColorSystem::Drawing::ColorThe color of the background fill.

Examples

Shows how to set pattern for a shape.

auto doc = MakeObject<Document>(MyDir + u"Shape stroke pattern border.docx");

auto shape = System::ExplicitCast<Shape>(doc->GetChild(NodeType::Shape, 0, true));
SharedPtr<Fill> fill = shape->get_Fill();

std::cout << String::Format(u"Pattern value is: {0}", fill->get_Pattern()) << std::endl;

// There are several ways specified fill to a pattern.
// 1 -  Apply pattern to the shape fill:
fill->Patterned(PatternType::DiagonalBrick);

// 2 -  Apply pattern with foreground and background colors to the shape fill:
fill->Patterned(PatternType::DiagonalBrick, System::Drawing::Color::get_Aqua(), System::Drawing::Color::get_Bisque());

doc->Save(ArtifactsDir + u"Shape.FillPattern.docx");

See Also