''
'' 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 glow effect to text and shapes in a DOCX.
Public Class GlowEffect
Function CreateDocx() As GcWordDocument
Dim doc = New GcWordDocument()
'' Custom text glow:
Dim style0 = doc.Styles.Add("style0", StyleType.Paragraph)
style0.Font.Size = 48
'' apply 5 point accent 6 glow effect to the text
Dim glow As Glow = style0.Font.Effects.Glow
glow.Radius = 5F
glow.Color.ThemeColor = ThemeColorId.Accent6
glow.Color.Transparency = 0.6F
doc.Body.Paragraphs.Add("Custom text glow.", style0)
'' Built-in text glow:
Dim style1 = doc.Styles.Add("style1", StyleType.Paragraph)
style1.Font.Size = 48
'' apply 5 point accent 5 glow effect to the text
style1.Font.Effects.ApplyBuiltInGlow(BuiltInGlowId.Radius5Accent5)
doc.Body.Paragraphs.Add("Built-in text glow.", style1)
'' Shape glow - direct:
Dim p = doc.Body.Paragraphs.Add()
Dim run = p.GetRange().Runs.Add()
Dim shape = run.GetRange().Shapes.Add(100, 100, GeometryType.Star5)
shape.Fill.Type = FillType.Solid
shape.Fill.SolidFill.ThemeColor = ThemeColorId.Accent1
'' apply 18 point accent 6 glow effect to the shape
shape.Effects.ApplyBuiltInGlow(BuiltInGlowId.Radius18Accent6)
p.GetRange().Runs.Add("Shape glow - direct.", doc.Styles(BuiltInStyleId.Strong))
'' Shape Glow - shapes style - direct color in format scheme's effect:
p = doc.Body.Paragraphs.Add()
p.Style.ParagraphFormat.Spacing.SpaceBefore = 30
run = p.GetRange().Runs.Add()
shape = run.GetRange().Shapes.Add(100, 100, GeometryType.Star5)
shape.Fill.Type = FillType.Solid
shape.Fill.SolidFill.ThemeColor = ThemeColorId.Accent1
'' apply 18 point accent 6 glow effect to the shape's style
Dim fmtEffect = doc.Theme.FormatScheme.Effects.Add()
fmtEffect.ApplyBuiltInGlow(BuiltInGlowId.Radius18Accent6)
shape.Style.Effects.ThemeEffects = fmtEffect
p.GetRange().Runs.Add("Shape Glow - shapes style - direct color in format scheme’s effect.", doc.Styles(BuiltInStyleId.Strong))
'' Shape Glow - shapes style - placeholder color in format scheme's effect:
p = doc.Body.Paragraphs.Add()
p.Style.ParagraphFormat.Spacing.SpaceBefore = 30
run = p.GetRange().Runs.Add()
shape = run.GetRange().Shapes.Add(100, 100, GeometryType.Star5)
shape.Fill.Type = FillType.Solid
shape.Fill.SolidFill.ThemeColor = ThemeColorId.Accent1
fmtEffect = doc.Theme.FormatScheme.Effects.Add()
fmtEffect.Glow.Color.ThemeColor = ThemeColorId.None
'' apply 18 point accent 6 glow effect to the shape's style
fmtEffect.Glow.Radius = 18F
shape.Style.Effects.PlaceholderColor.ThemeColor = ThemeColorId.Accent6
shape.Style.Effects.PlaceholderColor.Transparency = 0.6F
shape.Style.Effects.ThemeEffects = fmtEffect
p.GetRange().Runs.Add("Shape Glow - shapes style - placeholder color in format scheme’s effect.", doc.Styles(BuiltInStyleId.Strong))
'' Done:
Return doc
End Function
End Class