Object Model Reference : Classes : O : OutlineStyle : Properties : OutlineStyle.GapLength |
Property GapLength(Index As Long) As Long
Member of OutlineStyle
The GapLength property returns or specifies the length of each gap in an outline style. The number of dash/gap pairs can range from one to five. The length of each gap is calculated as a multiple of the width of the outline and is measured in document units. For example, if GapLength(1) = 2 and the width of the outline is 0.5", then the length of the first gap in the dash/gap pair is 1".
The following VBA example creates the dash/gap pattern of a selected dashed outline as a set of rectangles at the bottom of the page.
Sub Test() |
Const w As Double = 0.2 |
Dim x As Double, dx As Double |
Dim i As Long |
Dim s As Shape |
With ActiveShape.Outline |
If .Type = cdrOutline Then |
For i = 1 To .Style.DashCount |
dx = .Style.DashLength(i) * w |
Set s = ActiveLayer.CreateRectangle(x, 0, x + dx, w) |
s.Fill.UniformColor.RGBAssign 255, 0, 0 |
x = x + dx |
dx = .Style.GapLength(i) * w |
Set s = ActiveLayer.CreateRectangle(x, 0, x + dx, w) |
s.Fill.UniformColor.RGBAssign 255, 255, 0 |
x = x + dx |
Next i |
End If |
End With |
End Sub |
Copyright 2013 Corel Corporation. All rights reserved.