[Gambas-user] GridView Cell Height with WordWrap

Benoît Minisini g4mba5 at gmail.com
Wed Feb 24 15:09:35 CET 2021


Le 24/02/2021 à 13:53, Rolf-Werner Eilert a écrit :
> 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
> 

If you set the row height to -1, it should do the stuff for you.

Regards,

-- 
Benoît Minisini


More information about the User mailing list