FillOverlayEffect.vb
''
'' This code is part of Document Solutions for Word demos.
'' Copyright (c) MESCIUS inc. All rights reserved.
''
Imports System.Drawing
Imports GrapeCity.Documents.Word

'' This example shows how to add fill overlay effect to shapes in a DOCX.
Public Class FillOverlayEffect
    Function CreateDocx() As GcWordDocument
        Dim doc = New GcWordDocument()

        '' Shape fill overlay - direct:
        Dim p = doc.Body.Paragraphs.Add()
        Dim run = p.GetRange().Runs.Add()
        Dim shape = run.GetRange().Shapes.Add(100, 100, GeometryType.Star8)
        shape.Fill.Type = FillType.Solid
        shape.Fill.SolidFill.RGB = Color.LightBlue
        '' Apply solid fill overlay with another color to mix with the main fill:
        Dim overlay As FillOverlay = shape.Effects.FillOverlay
        overlay.BlendMode = BlendMode.Multiply
        overlay.Fill.Type = FillType.Solid
        overlay.Fill.SolidFill.RGB = Color.Yellow
        p.GetRange().Runs.Add("Shape fill overlay - direct.", doc.Styles(BuiltInStyleId.Strong))

        '' Shape FillOverlay - style effects, fixed color:
        p = doc.Body.Paragraphs.Add()
        p.Style.ParagraphFormat.Spacing.SpaceBefore = 30
        run = p.GetRange().Runs.Add()
        shape = run.GetRange().Shapes.Add(100, 100, GeometryType.Star8)
        shape.Fill.Type = FillType.Solid
        shape.Fill.SolidFill.RGB = Color.LightBlue
        '' apply solid fill overlay with another color to mix with the main fill
        Dim fmtEffect = doc.Theme.FormatScheme.Effects.Add()
        overlay = fmtEffect.FillOverlay
        overlay.BlendMode = BlendMode.Multiply
        overlay.Fill.Type = FillType.Solid
        overlay.Fill.SolidFill.RGB = Color.Yellow
        shape.Style.Effects.ThemeEffects = fmtEffect
        p.GetRange().Runs.Add("Shape FillOverlay - style effects, fixed color.", doc.Styles(BuiltInStyleId.Strong))

        '' Shape FillOverlay - style effects, fixed and placeholder color usage, pattern color
        '' (BackColor uses fixed color, ForeColor uses placeholder color):
        p = doc.Body.Paragraphs.Add()
        p.Style.ParagraphFormat.Spacing.SpaceBefore = 30
        run = p.GetRange().Runs.Add()
        shape = run.GetRange().Shapes.Add(100, 100, GeometryType.Star8)
        shape.Fill.Type = FillType.Solid
        shape.Fill.SolidFill.RGB = Color.LightBlue
        '' Apply pattern fill overlay with another color to mix with the main fill:
        fmtEffect = doc.Theme.FormatScheme.Effects.Add()
        overlay = fmtEffect.FillOverlay
        overlay.BlendMode = BlendMode.Multiply
        Dim foFill = overlay.Fill
        foFill.Type = FillType.Pattern
        foFill.PatternFill.Type = PatternFillType.DashedHorizontal
        foFill.PatternFill.ForeColor.ThemeColor = ThemeColorId.None
        foFill.PatternFill.BackColor.ThemeColor = ThemeColorId.Accent6
        shape.Style.Effects.PlaceholderColor.ThemeColor = ThemeColorId.Accent3
        shape.Style.Effects.PlaceholderColor.Transparency = 0.6F
        shape.Style.Effects.ThemeEffects = fmtEffect
        p.GetRange().Runs.Add("Shape FillOverlay - style effects, fixed and placeholder color usage, pattern color.", doc.Styles(BuiltInStyleId.Strong))

        '' Done:
        Return doc
    End Function
End Class