[Gambas-user] GridView.ClientWidth yields incorrect size on Form_Open
Gianluigi
bagonergi at gmail.com
Sat Feb 2 23:05:59 CET 2019
Il giorno sab 2 feb 2019 alle ore 20:54 T Lee Davidson <
t.lee.davidson at gmail.com> ha scritto:
> ...
> Charlie, thank you for that code. Setting the column width to -1 does
> automatically resize the column to fit the data. However,
> I am trying to achieve the behavior that the Expand property is supposed
> to give: "Return or set if a GridView column
> automatically expands to fit the GridView width." Meaning, as I understand
> it, similar to AutoResize but for a column other than
> the last column.
>
> I have actually accomplished this by capturing the sum of the column
> widths within the For loop and then resizing the first
> column mathematically within the Arrange event. It would seem, though,
> that using the Expand property would be much simpler and
> more sensible.
>
>
> ___
> Lee
>
If with "Charlie" you're referring to me, also me can not get Expand to
work.
But I think you can easily replace it with Width = -1:
'-------------------------------
Public Sub Form_Open()
Dim Headers As String[] = ["0123456789", "0123456789", "0123456789",
"0123456789"]
With GridView1
.AutoResize = False
.Header = GridView.Horizontal
End With
GridView1.Rows.Count = 1
GridView1.Columns.Count = Headers.Count
For i As Integer = 0 To Headers.Max
GridView1.Columns[i].Title = Headers[i]
GridView1[0, i].Text = String(30, "*")
Next
GridView1.Columns[0].Width = -1
End
'-------------------------------
But also I would be curious to know how to set Expand ;-)
Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190202/7c1f9723/attachment.html>
More information about the User
mailing list