API Documentation > CorelDRAW > 2025-v26 > ShapeRange > IVGShapeRange
ShapeRange.ApplyPatternFill method
Apply a Pattern Fill to all shapes in the range
Syntax:
Sub 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)
Parameters:
Name Type Description
Type
FileName
String
PatternCanvasIndex
Long
Specifies the index number of the pattern canvas.
FrontColor
Specifies the foreground color in a pattern fill.
EndColor
Specifies the background color in a pattern fill.
TransformWithShape
Boolean
Specifies whether the pattern fill changes to fit its shape when the shape is altered. If the value is True, the pattern fill changes according to changes in its shape.
Remarks:
The ApplyPatternFill method applies the specified pattern fill to all the shapes in a shape range.
Examples:
The following VBA example applies a two-color pattern fill and an outline to each text shape on the page.
Sub Test()
Dim sr As ShapeRange
Set sr = ActivePage.FindShapes(Type:=cdrTextShape)
sr.ApplyPatternFill cdrTwoColorPattern, , 4, CreateRGBColor(255, 0, 0)
sr.SetOutlineProperties 0.05 
End Sub