Aspose::Words::Drawing::Stroke::get_Color2 method

Stroke::get_Color2 method

Defines a second color for a stroke.

System::Drawing::Color Aspose::Words::Drawing::Stroke::get_Color2()

Remarks

The default value for a Shape is White.

Examples

Shows how to process shape stroke features.

auto doc = MakeObject<Document>(MyDir + u"Shape stroke pattern border.docx");
auto shape = System::ExplicitCast<Shape>(doc->GetChild(NodeType::Shape, 0, true));
SharedPtr<Stroke> stroke = shape->get_Stroke();

// Strokes can have two colors, which are used to create a pattern defined by two-tone image data.
// Strokes with a single color do not use the Color2 property.
ASPOSE_ASSERT_EQ(System::Drawing::Color::FromArgb(255, 128, 0, 0), stroke->get_Color());
ASPOSE_ASSERT_EQ(System::Drawing::Color::FromArgb(255, 255, 255, 0), stroke->get_Color2());

ASSERT_FALSE(stroke->get_ImageBytes() == nullptr);
System::IO::File::WriteAllBytes(ArtifactsDir + u"Drawing.StrokePattern.png", stroke->get_ImageBytes());

See Also