[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
this is my 800th post:p
Re: MSHFlexGrid: Auto adjusting grid to fit visible rows
Close... I used
vb Code:
.Height = ((.GridLineWidth + .CellHeight) * (Count - 1))
It's close though. It's something I can now work with.
Thanks again...
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
Re: MSHFlexGrid: Auto adjusting grid to fit visible rows
I tried it, this works better for me
vb Code:
.Height = .RowHeight(Count - 1) * Count
Why the arbitrary number 90????
Re: MSHFlexGrid: Auto adjusting grid to fit visible rows
Re: MSHFlexGrid: Auto adjusting grid to fit visible rows
Quote:
Originally Posted by randem
I tried it, this works better for me
vb Code:
.Height = .RowHeight(Count - 1) * Count
Why the arbitrary number 90????
Don't know about the 90, it just works
1 Attachment(s)
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.
Thanks for all the input...