Object Model Reference : Classes : F : FountainFill : Methods : FountanFill.Translate |
Sub Translate(x As Double, y As Double)
Member of FountainFill
The Translate method repositions the fountain-fill vector. Both the starting and ending points of the fountain fill vector are moved by the specified offset.
Parameter
|
Description
|
x
|
Specifies the horizontal offset, measured in document units
|
y
|
Specifies the vertical offset, measured in document units
|
The following VBA example centers a fountain fill in the active shape (by placing the center of the fill in the center of the shape).
Sub Test() |
Dim ff As FountainFill |
Dim cx As Double, cy As Double ' Current position of fill center |
Dim sx As Double, sy As Double ' Shape's center |
If ActiveShape.Fill.Type = cdrFountainFill Then |
Set ff = ActiveShape.Fill.Fountain |
Select Case ff.Type |
Case cdrSquareFountainFill, cdrRadialFountainFill, cdrConicalFountainFill |
cx = ff.StartX |
cy = ff.StartY |
Case cdrLinearFountainFill |
cx = (ff.StartX + ff.EndX) / 2 |
cy = (ff.StartY + ff.EndY) / 2 |
End Select |
ActiveDocument.ReferencePoint = cdrCenter |
ActiveShape.GetPosition sx, sy |
ff.Translate sx - cx, sy - cy |
End If |
End Sub |
Copyright 2013 Corel Corporation. All rights reserved.