Navigation:  Articles > Jun-1998 >

Tip: Growing Lines

Previous pageReturn to chapter overviewNext page

Militaru Sorin          
 
In a tabular report that displays each record as a row of fields, setting the properties CanGrow = True and BorderStyle = Normal for graphic elements like lines doesn't always work the way you want. In the Detail section, however, without BorderStyle = Normal, vertical lines might disappear.
 
Here's a subroutine to solve this problem. This procedure has to be called on the OnPrint event for the report's Detail section using CreateVerticalLines(Me):
 

Sub CreateVerticalLines (rptCurrent As Report)

 

Dim intMaxHeight As Integer

Dim intControlsNo As Integer

Dim intCnter As Integer

 

intMaxHeight = 0

 

' Determine max height of text boxes in Detail Section

intControlsNo = rptCurrent.Count

For intCnter = 0 To intControlsNo - 1

 If rptCurrent(intCnter).Section = 0 Then

  If TypeOf rptCurrent(intCnter) Is TextBox Then

    If rptCurrent(intCnter).Height > intMaxHeight Then

        intMaxHeight = rptCurrent(intCnter).Height

    End If

  End If

 End If

Next intCnter

 

' Drawing first line

rptCurrent.Line (0, 0)-Step(0, intMaxHeight)

 

' Drawing the lines from right side of controls

For intCounter = 0 To intControlsNo - 1

    If rptCurrent(intCounter).Section = 0 Then

       If TypeOf rptCurrent(intCounter) Is TextBox Then

           rptCurrent.Line (rptCurrent(intCounter).left _ 

             + rptCurrent(intCounter).width, 0)-Step(0, _

                intMaxHeight)

        End If

    End If

Next intCounter

 

End Sub