Previous Document Next Document
OutlineStyle.GapLength

Property GapLength(Index As Long) As Long

Member of OutlineStyle

The GapLength property returns or sets the length of each gap in an outline style. The number of dash/gap pairs can range from 1 to 5. 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 inch, the length of the first gap in the dash/gap pair is 1 inch.

Parameters
Description
Index
Specifies a dash and gap pair in an outline style

The following code example creates an dash and gap pattern of an outline as a set of rectangles at the bottom of the page. Before you run this macro, you must create an object with a dashed outline and have the object selected.

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 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.