Previous Document Next Document
Fill.ApplyUniformFill

Sub ApplyUniformFill(Color As Color)

Member of Fill

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

Alternatively you can assign a uniform fill by modifying the UniformColor property.

Parameters
Description
Color
Specifies the color of the fill using an existing color component in a palette or a CreateColor method (for example, CreateCMYKColor or CreateRGBColor)

The following code 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 2007 Corel Corporation. All rights reserved.