[RESOLVED] MSHFlexGrid: Auto adjusting grid to fit visible rows
How can one automatically get the flexgrid to only display visible rows without displaying partially visible rows? I want to resize the grid to the exact size of the visible rows.
Re: MSHFlexGrid: Auto adjusting grid to fit visible rows
try this randem:
Code:
Private Const CHECKCELLSIZE As Long = 17
Private Sub Form_Load()
Dim hL As Long
With MSHFlexGrid1
.Rows = 20
.Cols = 2
hL = GetVisibleRows(Me.MSHFlexGrid1)
.Height = (.GridLineWidth + CHECKCELLSIZE * (hL - 1)) * Screen.TwipsPerPixelY
End With
Re: MSHFlexGrid: Auto adjusting grid to fit visible rows
I found this a couple yrs ago and been using it ever since. My project has about 20 grids that are always being resized
With Grid
.Height = .RowHeight(.Rows - 1) * .Rows + 90
End With
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders
Re: MSHFlexGrid: Auto adjusting grid to fit visible rows
Ok, I added the 90 back in and it solved the other issues. I believe it may be the separator line between rows and now the whole row is visible and not causing trouble. I really don't like leaving exposed unexplained numbers in the code but until I find where to get that number... Here is the working code.