Object Model Reference : Classes : O : OutlineStyle : Properties : OutlineStyle.DashLength |
Property DashLength(Index As Long) As Long
Member of OutlineStyle
The DashLength property returns or specifies the length of each dash in an outline style. The number of dash/gap pairs can range from one to five. The length of each dash is calculated as a multiple of the width of the outline and is measured in document units. For example, if DashLength(1) = 2 and the width of the outline is 0.5", then the length of the first dash 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.