Previous Document Next Document

Object Model Reference : Classes : F : Fill : Methods : Fill.ApplyUniformFill


Fill.ApplyUniformFill

Sub ApplyUniformFill(Color As Color)

Description

Member of Fill

The ApplyUniformFill method applies a uniform fill to a shape by using a Color object.

 
Alternatively, you can assign a uniform fill to a shape by modifying the Fill.UniformColor property.

Parameter
Description
Color
Specifies the fill color by referencing an existing color component in a palette or a Create...Color method (for example, Application.CreateCMYKColor or Application.CreateRGBColor)

VBA example

The following VBA examples creates swatches for each color in the default color palette that is open. A rectangle is created for each color in the palette and is then filled with the color. New pages are added if the swatches cannot fit on a single page.

Sub Test()
 Dim d As Document
 Dim p As Page
 Dim c As Color
 Dim s As Shape
 Const sx As Double = 0.5
 Const sy As Double = 0.5
 Dim x As Double, y As Double
 Dim MaxX As Long, nx As Long
 Dim MaxY As Long, ny As Long
 x = 0
 y = 0
 nx = 0
 Set d = CreateDocument
 d.Unit = cdrInch
 Set p = d.ActivePage
 MaxX = CLng(p.SizeWidth / sx)
 MaxY = CLng(p.SizeHeight / sy)
 For Each c In ActivePalette.Colors
  Set s = p.ActiveLayer.CreateRectangle(x, y, x + sx, y + sy)
  s.Fill.ApplyUniformFill c
  x = x + sx
  nx = nx + 1
  If nx = MaxX Then
   nx = 0
   x = 0
   y = y + sy
   ny = ny + 1
   If ny = MaxY Then
    ny = 0
    y = 0
    Set p = d.AddPages(1)
   End If
  End If
 Next c
End Sub

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.