[Gambas-user] GridView.ClientWidth yields incorrect size on Form_Open

Gianluigi bagonergi at gmail.com
Sat Feb 2 08:22:42 CET 2019


You can try this code:
'--------------------------------------------------------------
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
  GridView1.Columns[0].Expand = True
  For i As Integer = 0 To Headers.Max
    GridView1.Columns[i].Title = Headers[i]
    GridView1[0, i].Text = String(30, "*")
  Next

End

Public Sub Form_Arrange()
  '' Try also with the de-commented code
  'GridView1.Columns.Width = -1

End
'-----------------------------------------------------------------
Regards
Gianluigi


Il giorno sab 2 feb 2019 alle ore 04:09 Denis Crowther <
denisc at exemail.com.au> ha scritto:

> I set the width to -1 which had no effect.
> Using expand, with or without the width = -1, worked.
>
>
>
>
> ps: Sorry Benoît, I didn't realise I had sent it to you personally.
>
> Regards
> Denis
>
> On 2/2/19 2:30 am, Benoît Minisini wrote:
> > Le 01/02/2019 à 15:53, T Lee Davidson a écrit :
> >> On 2/1/19 3:51 AM, Rolf-Werner Eilert wrote:
> >>> Now that I read your hint to use Arrange, of course I tried it, but
> >>> it has no effect.
> >>>
> >>> Regards
> >>> Rolf
> >>
> >> In my project, I am resizing the first column to give it all extra
> >> available width; like AutoResize, but for the first column verses the
> >> last. Using the Arrange event works perfectly. (Thank you for that
> >> guidance, Benoît.)
> >>
> >>
> >> ___
> >> Lee
> >>
> >
> > Another way is setting the column width to "-1" or setting the column
> > Expand property to TRUE.
> >
> > Regards,
> >
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190202/16698060/attachment.html>


More information about the User mailing list