Aspose::Words::Shading::set_ForegroundTintAndShade method

Shading::set_ForegroundTintAndShade method

Sets a double value that lightens or darkens a foreground theme color.

void Aspose::Words::Shading::set_ForegroundTintAndShade(double value)

Remarks

The allowed values are in the range from -1 (the darkest) to 1 (the lightest) for this property.

Zero (0) is neutral.

Examples

Shows how to set foreground and background colors for shading texture.

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

System::SharedPtr<Aspose::Words::Shading> shading = doc->get_FirstSection()->get_Body()->get_FirstParagraph()->get_ParagraphFormat()->get_Shading();
shading->set_Texture(TextureIndex::Texture12Pt5Percent);
shading->set_ForegroundPatternThemeColor(ThemeColor::Dark1);
shading->set_BackgroundPatternThemeColor(ThemeColor::Dark2);

shading->set_ForegroundTintAndShade(0.5);
shading->set_BackgroundTintAndShade(-0.2);

builder->get_Font()->get_Border()->set_Color(System::Drawing::Color::get_Green());
builder->get_Font()->get_Border()->set_LineWidth(2.5);
builder->get_Font()->get_Border()->set_LineStyle(LineStyle::DashDotStroker);

builder->Writeln(u"Foreground and background pattern colors for shading texture.");

doc->Save(get_ArtifactsDir() + u"Font.ForegroundAndBackground.docx");

Exceptions

  • ArgumentOutOfRangeException - Throw if set this property to a value less than -1 or more than 1.
  • InvalidOperationException - Throw if set this property for Shading object with non-theme colors.

See Also