Jump to content

Dynamic StringGrid height


skafy

Recommended Posts

How can I change StringGrid height dynamically depending on height of rows. I'm trying to get height of each row, but I allways get 0.

for i := 0 to RowCount - 1 do
  inc(MyHeight, RowHeights[i]);
end;

At the end MyHeight is allways 0. So how can I get StringGrid actual rows height so there wouldn't have to be scroller inside.

Link to comment
Share on other sites

  • 4 weeks later...

If you enclose your text in cells using similar style

<span style="word-wrap: break-word; white-space: pre-line;">some text</span>

the browser itself will calculate the height. At least it works for DBGrid, nevert tried with StringGrid. However you can edit cells directly in dbgrid, so TClientDataSet + UniDBGrid might be a better option for you instead of StringGrid.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...