API Documentation > CorelDRAW > 2025-v26 > Fill > IVGFill
Fill.ApplyPatternFill method
Apply a Pattern Fill to the shape
Syntax:
Function ApplyPatternFill(ByVal Type As cdrPatternFillType, Optional ByVal FileName As String, Optional ByVal PatternCanvasIndex As Long = 1, Optional ByVal FrontColor As Color = Nothing, Optional ByVal EndColor As Color = Nothing, Optional ByVal TransformWithShape As Boolean = False) As PatternFill
Parameters:
Name Type Description
Type
FileName
String
PatternCanvasIndex
Long
Specifies the pattern canvas by its index number.
FrontColor
Specifies the foreground color for the pattern fill.
EndColor
Specifies the background color for the pattern fill.
TransformWithShape
Boolean
Specifies whether to transform the pattern fill with the shape.
Remarks:
The ApplyPatternFill method applies a pattern fill to a shape. There are three types of pattern fills: two-color, full-color vector, and bitmapped.
Examples:
The following VBA example creates a rectangle and applies a bitmapped pattern fill to it.
Sub Test()
Dim s As Shape
Set s = ActiveLayer.CreateRectangle(0, 0, 5, 5)
s.Fill.ApplyPatternFill cdrBitmapPattern, Application.Path + "Custom Data\Canvas\breadc.pcx" 
End Sub