G
Guest
I am trying to use the fTextHeightWidth method to expand the height of a row
of controls to the that of the largest control.
I use the fTextHeight method to get the number of lines needed for the value
in the textbox controls (see sample code below). This works most of the time
but it occasionally under estimates the total number of lines needed. When
this happens the control is incorrectly sized to its contents.
I tried using the print lines module as an alternate, but I need to
conditionally change the background colors of some of the controls and with
lines drawn the controls will not necessarily have the appropriate height for
the correspnding section in the grid to appear completely filled.
1. Has anyone had a similar problem with fTextHeight? Any recommendations on
fixing it?
2. Any idea how I can set the background color for a single section of a
grid created by print lines?
Sample Code:
Dim lngWidth7 As Long, lngHeight7 As Long, lngTotalLines7 As Long, lngRet7
As Long
lngRet7 = fTextHeight(controlName, , lngHeight7, lngWidth7, lngTotalLines7)
heightOfCell = 270
multiplier = 1
If multiplier < lngTotalLines7 Then
multiplier = lngTotalLines7
End If
total = heightOfCell * multiplier
Dim CtlDetail As Control
For Each CtlDetail In Me.Section(acDetail).Controls
With CtlDetail
If CtlDetail.Visible Then
CtlDetail.Height = total
End If
End With
Next
of controls to the that of the largest control.
I use the fTextHeight method to get the number of lines needed for the value
in the textbox controls (see sample code below). This works most of the time
but it occasionally under estimates the total number of lines needed. When
this happens the control is incorrectly sized to its contents.
I tried using the print lines module as an alternate, but I need to
conditionally change the background colors of some of the controls and with
lines drawn the controls will not necessarily have the appropriate height for
the correspnding section in the grid to appear completely filled.
1. Has anyone had a similar problem with fTextHeight? Any recommendations on
fixing it?
2. Any idea how I can set the background color for a single section of a
grid created by print lines?
Sample Code:
Dim lngWidth7 As Long, lngHeight7 As Long, lngTotalLines7 As Long, lngRet7
As Long
lngRet7 = fTextHeight(controlName, , lngHeight7, lngWidth7, lngTotalLines7)
heightOfCell = 270
multiplier = 1
If multiplier < lngTotalLines7 Then
multiplier = lngTotalLines7
End If
total = heightOfCell * multiplier
Dim CtlDetail As Control
For Each CtlDetail In Me.Section(acDetail).Controls
With CtlDetail
If CtlDetail.Visible Then
CtlDetail.Height = total
End If
End With
Next