Previous Document Next Document

Object Model Reference : Classes : S : Shape : Properties : Shape.Effect


Shape.Effect

Property Effect As Effect

Description

Member of Shape

The Effect property represents the Effect object for shapes generated by an effect (contour or blend groups, extrusion facets, and so on).

The Effect property represents a read-only value.

VBA example 1

The following VBA example creates a blend between two ellipses. It iterates through all shapes on the page to locate the blend group and changes some blend parameters. This example is just a demonstration of the Effect property; you can use the Effect object returned by the CreateBlend method directly if you want to set properties of the created blend.

Sub Test()
 Dim doc As Document
 Dim e1 As Shape, e2 As Shape, s As Shape
 Set doc = CreateDocument
 Set e1 = doc.ActiveLayer.CreateEllipse(0, 0, 2, 2)
 e1.Fill.UniformColor.RGBAssign 255, 0, 0
 Set e2 = doc.ActiveLayer.CreateEllipse(4, 4, 5, 5)
 e2.Fill.UniformColor.RGBAssign 0, 0, 255
 e1.CreateBlend e2
 For Each s In doc.ActivePage.Shapes
  If s.Type = cdrBlendGroupShape Then
   With s.Effect.Blend
    .Steps = 5
    .ColorBlendType = cdrRainbowCWFountainFillBlend
   End With
  End If
 Next s
End Sub
VBA example 2

The following VBA example changes the blend-effect properties immediately after creating the blend. Alternatively, you can set most of the parameters for the blend directly in the CreateBlend method.

Sub Test()
 Dim doc As Document
 Dim e1 As Shape, e2 As Shape, eff As Effect
 Set doc = CreateDocument
 Set e1 = doc.ActiveLayer.CreateEllipse(0, 0, 2, 2)
 e1.Fill.UniformColor.RGBAssign 255, 0, 0
 Set e2 = doc.ActiveLayer.CreateEllipse(4, 4, 5, 5)
 e2.Fill.UniformColor.RGBAssign 0, 0, 255
 Set eff = e1.CreateBlend(e2)
 eff.Blend.Steps = 5
 eff.Blend.ColorBlendType = cdrRainbowCWFountainFillBlend
End Sub
VBA example 3

The following VBA example runs more efficiently, setting all blend parameters in a single command.

Sub Test()
 Dim doc As Document
 Dim e1 As Shape, e2 As Shape, eff As Effect
 Set doc = CreateDocument
 Set e1 = doc.ActiveLayer.CreateEllipse(0, 0, 2, 2)
 e1.Fill.UniformColor.RGBAssign 255, 0, 0
 Set e2 = doc.ActiveLayer.CreateEllipse(4, 4, 5, 5)
 e2.Fill.UniformColor.RGBAssign 0, 0, 255
 e1.CreateBlend e2, 5, cdrRainbowCWFountainFillBlend
End Sub
VBA example 4

The following VBA example changes the number of steps in all blends found on a page and removes any extrusions.

Sub Test()
 Dim s As Shape
 For Each s In ActivePage.Shapes
  Select Case s.Type
   Case cdrExtrudeGroupShape
    s.Effect.Clear
   Case cdrBlendGroupShape
    s.Effect.Blend.Steps = 50
  End Select
 Next s
End Sub

The usefulness of the Shape.Effect property is apparent when working with many effects in a document.

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.