You can use grid.AutoSizeRow(s) to have the grid automatically adapt the row height to the height of text in cells.
this doesn't do anything when I try this.
Calling grid.AutoSizeRows() does not depend on other settings.
I did use it wrong, works fine now
In a TDBAdvGrid, I want to auto resize the rows if there is any change to the width of a column, either by resizing the column directly or if I resize the form and a column is set to stretch (my column 4 is set to stretch), and I want it done efficiently.
I put a call to AutoSizeRows after the grid is loaded and on the grid's OnColumnSizing event. However, the OnColumnSizing event only occurs if I manually resize the column and does not occur when the form is resized (my stretch column get resized, so why not? Different event?). So, I added the call to the grid's OnResize event, but that also does not get invoked when resizing the form. Note: the grid is not aligned (alNone) but is anchored top, left, bottom, right. So I would expect that event to occur when resizing the form, but doesn't (why not?). So I put the call into its parent panel's OnResize event which basically does the same thing..
Is this the most efficient way to do all of this? Seems like if I change the form's height it still calls AutoSizeRows needlessly. It would be better if auto stretching a column calls the OnColumnSizing event, but as I mentioned, it doesn't.
OnColumnSize() was not triggered during a stretch invoked resize.
It is a good suggestion to also trigger it in this case. We did this improvement that will be included in the next update.