Re: Setting StringGrid.Height

Posted by webmaster Guido on January 28, 2009

In Reply to Setting StringGrid.Height posted by Lee Hallin p12462 on January 27, 2009

: I have a StringGrid that I populate on the fly. Once I'm done populating it, I want to set the .height property such that the bottom border is just below the [possible horizontal scroll bar and] last line in the StringGrid. When I click the button with the following code, the bottom border ends up below row 7 out of 10 rows. I'm guessing it is because I am summing the height of the characters but not the space above and below the horizontal lines. Is there some other property(s) I should be summing to get the results I want?
: ...

Well, the total height of a StringGrid component is influenced by:
  Grid.RowCount
  Grid.DefaultRowHeight
  Grid.RowHeights
  its "Bevels" (borders)
  etc...

So, it's not easy to calculate the exact total height. I'm testing some combinations, just give me some time ;)

Unless... you agree with an approximation that at least shows all or most of the rows, but sometimes with a vertical scrollbar?

Please let me know,
webmaster Guido

Related articles