[Gambas-user] GridView Cell Height with WordWrap

Rolf-Werner Eilert rwe-sse at osnanet.de
Wed Feb 24 13:53:47 CET 2021


When I want to have the individual rows adapt to the correct height to 
show every line of word-wrapped text, how can I achieve that?

This is what I tried. "lsMeine" is the GridView:

Public Sub lsMeine_Data(Row As Integer, Column As Integer)

   If Row Mod 2 = 0 Then
     lsMeine.Data.Background = Color.Lighter(Color.LightGray)
     lsMeine.Data.Text = nzEigene[Row]
   Else
     lsMeine.Data.WordWrap = True
     lsMeine.Data.Text = nzEigene[Row]
     lsMeine.Rows[Row].Height = lsMeine.Font.TextHeight(nzEigene[Row])
   Endif

I try to attach a screenshot.

In line [1] of the list it doesn't work (because the text doesn't have a 
line break (LF) in it?). In line [3] it runs well, there are several 
line breaks.

So, I have to find out the necessary height of the cell even when text 
has been word-wrapped only.

Regards
Rolf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bildschirmfoto zu 2021-02-24 13-51-26.png
Type: image/png
Size: 19050 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210224/54e52f1f/attachment.png>


More information about the User mailing list