gridview header height

Post Reply
bill-lancaster
Posts: 32
Joined: Tuesday 26th September 2017 3:17pm

gridview header height

Post by bill-lancaster » Monday 29th October 2018 3:32pm

Is there a way to determine the height of the header in gridview?

bill-lancaster
Posts: 32
Joined: Tuesday 26th September 2017 3:17pm

Re: gridview header height

Post by bill-lancaster » Tuesday 30th October 2018 1:37pm

I ask because, although the header height will usually be the same as row height, it possible for header height to be a multiple of row height.

User avatar
cogier
Site Admin
Posts: 193
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: gridview header height

Post by cogier » Tuesday 30th October 2018 4:12pm

The only way I can find to set the header height is to set the font size.

Image

Try the following code: -
Public Sub Form_Open()
Dim GridView1 As GridView
Dim sText As String[] = ["Hello", "world!", "Charlie", "was", "here!"]
Dim siCount, siLoop As Short

With Me
  .Width = 900
  .Height = 200
  .Padding = 5
  .Arrangement = Arrange.Vertical
  .Text = "Gridview header height"
End With

GridView1 = New GridView(Me) As "GridView1"

With GridView1
  .Expand = True
  .Header = GridView.Horizontal
  .Font.Size = 40
  .Font.Bold = True
  .Columns.Count = 5
  .Rows.Count = 5
End With

Print GridView1.Rows.height ''Is there a way to determine the height of the header in gridview?

For siCount = 0 To sText.Max
  GridView1.Columns[siCount].Title = sText[siCount]
  GridView1.Columns[siCount].Alignment = Align.Center
Next

For siLoop = 0 To sText.Max
  GridView1.Rows[siLoop].Height = 20
  For siCount = 0 To sText.Max
    GridView1[siLoop, siCount].Text = sText[siCount]
    GridView1[siLoop, siCount].Font.Size = 12
    GridView1[siLoop, siCount].Font.Bold = False
  Next
Next

End
Is there a way to determine the height of the header in gridview?
If you add the following see line 25 above: -
Print GridView1.Rows.height
Do this before you lower the height of the rows (line 33).

bill-lancaster
Posts: 32
Joined: Tuesday 26th September 2017 3:17pm

Re: gridview header height

Post by bill-lancaster » Thursday 01st November 2018 6:22pm

That is amazing!
Thank you so much, I think this may be the only solution but such a complex solution to a simple matter
Regards

Post Reply