Previous Document Next Document

Object Model Reference : Classes : P : PatternCanvases : Methods : PatternCanvases.Add


PatternCanvases.Add

Function Add(PatternCanvas As PatternCanvases) As Long

Description

Member of PatternCanvases

The Add method adds a two-color fill pattern to the PatternCanvases collection. The additional pattern is added to the 2-color list box in the Pattern Fill dialog box.

Parameter
Description
PatternCanvas
Specifies the pattern canvas to add to the PatternCanvases collection

VBA example

The following VBA example creates a pattern on a new 64 × 64 bitmap and adds it to the list of available two-color fills. It then applies the fill pattern to a newly created rectangle.

Sub Test()
 Dim c As New PatternCanvas
 Dim n As Long
 c.Size = cdrPatternCanvas64x64
 c.Clear
 For n = 2 To 63 Step 2
  c.Line (0, 0)-(n, n), , B
 Next n
 On Error Resume Next ' The code in green is a workaround.
 n = PatternCanvases.Add(c)
 If Err.Number Then n = PatternCanvases.Add(c)
 On Error GoTo 0
 With ActiveLayer.CreateRectangle(0, 0, 3, 3)
  .Fill.ApplyPatternFill cdrTwoColorPattern, , n
 End With
End Sub

•
 
You can apply a pattern canvas without adding it to the PatternCanvases collection.

•
 
See also the example for the PatternCanvases.Item property.

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.