[Gambas-user] GridView Cell Height with WordWrap

Bruce Steers bsteers4 at gmail.com
Wed Feb 24 15:04:22 CET 2021


did you try .Height = -1

.Width = -1 auto sets the width , i'd assume .Height works the same.

BruceS

On Wed, 24 Feb 2021 at 13:01, Rolf-Werner Eilert <rwe-sse at osnanet.de> wrote:

> 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
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210224/b283326c/attachment.htm>


More information about the User mailing list