Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to draw detail box set at tallest control 1

Status
Not open for further replies.

bradles

Technical User
Sep 15, 2002
110
AU
Thanks to dhookum I'm trying to implement the following code to draw boxes around the controls in the details section set at the tallest control at the On-Print event:

Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    Dim lngHeight As Long 'store the height of tallest control
    Dim CTL As Access.Control
    
    'set the height of tallest
    lngHeight = Me.txtItemObjectiveText.Height
    
    'draw the box
    For Each CTL In Me.Detail.Controls
            Me.Line (CTL.Left, 0)-(CTL.Left, lngHeight), RGB(0, 0, 0)
    Next
    Set CTL = Nothing
End Sub

All I get is vertical lines that are set at the right height, but no horizontal lines. Anyone had any more experience with the Line function?
 
Hi
I think something like this should work:
[tt]Me.Line (CTL.Left, 0)-(CTL.Left + CTL.Width, lngHeight), RGB(0, 0, 0), [red]B[/red][/tt]
 
Thanks Remou but no luck, I gather the 'B' indicates drawing a box? Nothing appears at all with the 'B' switch.

Any other ideas?
 
Hi
This is the exact code I used to test:
Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    Dim lngHeight As Long 'store the height of tallest control
    Dim CTL As Access.Control
    
    For Each CTL In Me.Detail.Controls
        If CTL.Height > lngHeight Then
            lngHeight = CTL.Height
        End If
    Next

    For Each CTL In Me.Detail.Controls
        Me.Line (CTL.Left, 0)-(CTL.Left + CTL.Width, lngHeight), RGB(0, 0, 0), B
    Next
    Set CTL = Nothing
End Sub
It worked for me. Did you notice CTL.Left + CTL.Width, which I put in as well as B? I did not highlight it. [ponder]
 
Remou, you are a champion. Thanks for spotting that error, it works a treat.

Have a star.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top