Given that I want my string grid to have equal height rows ...
I know that it will start with exactly 5 rows and I make it so at design time.
At run time I may want to add some extra rows (and I have code to not add below the bottom of the parent; at that point I rely on scroll bars).
It seems that sg.height := sg.height + sg.RowHeights[0]; is not producing the expected result - there is unexpecetd whitespace after the last row (I am still trying to calculate how the extra height corresponds to the number of rows, but it looks like it is the height of one row, no matter how many rows are in the grid).
Is there something else I should take into account? (perhaps GridLineWidth?) Or could I have set a property wrongly in the Object Inspector? Should I be using GridHeight
, rather than Height
?
Note: this problem only occurs when the stringgid is as wide as all cells and the scroll bar appears, drawing over part of the last column. If I leave an ugly blank sapce at the right of the string grid for the scroll bar to fit into, the problem does not occur.
Can anyone tell me the formula to calculate the new gridheight after adding a number of rows? Or wthere I am doing something wrong.
[Update] The fudge factor of 3 apears to correspond to the margin
property