General information
Category:
Forms & Form designer
Did you sort this?
This seems to do the trick:
LPARAMETERS toControl, tnRowCount
*-- Returns the rowheight or totalheight for the listbox control passed in
LOCAL lnReturn, lnTextHeight, lnExtraHeight, lcStyle
*-- Calculate Height Of Text
*-- First, What's the style?
lcStyle = IIF( toControl.FontBold, "B", "") + ;
IIF( toControl.FontItalic, "I", "") + ;
IIF( toControl.FontOutline, "O", "") + ;
IIF( toControl.FontShadow, "S", "") + ;
IIF( toControl.FontUnderline, "U", "") + ;
IIF( toControl.FontStrikeThru, "-", "")
lnTextHeight = FONTMETRIC( 1, toControl.FontName, toControl.FontSize, lcStyle)
lnExtraHeight = FONTMETRIC( 5, toControl.FontName, toControl.FontSize, lcStyle)
*-- Calculate RowHeight
*-- Fox adds 2 pixels to each row
lnReturn = ( lnTextHeight + lnExtraHeight + 2)
IF PCOUNT() = 2 AND VARTYPE( tnRowCount) = "N"
*-- Calculate total height of control
*-- All the rows, plus 2 for the top border and two for botton border
lnReturn = (lnReturn * tnRowCount) + 4
ENDIF
RETURN lnReturn
>Well I / you could (derive it) I expect, but I am adverse to using empirically derived formular unless necessary. But since no one has offered a proper solution it's looking that way. But I shall leave a decision till next week in case a better answer develops.
>Does your offer mean you have good insight into font metrics? I aways get lost in the world of leading / descenders etc when I return to font sizes!
>Thanks
>Dave
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only