Results 1 to 8 of 8

Thread: [RESOLVED] MSHFlexGrid: Auto adjusting grid to fit visible rows

  1. #1

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Resolved [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.

  2. #2
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    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

  3. #3

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: MSHFlexGrid: Auto adjusting grid to fit visible rows

    Close... I used
    vb Code:
    1. .Height = ((.GridLineWidth + .CellHeight) * (Count - 1))
    It's close though. It's something I can now work with.

    Thanks again...

  4. #4
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    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

  5. #5

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: MSHFlexGrid: Auto adjusting grid to fit visible rows

    I tried it, this works better for me
    vb Code:
    1. .Height = .RowHeight(Count - 1) * Count

    Why the arbitrary number 90????

  6. #6
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: MSHFlexGrid: Auto adjusting grid to fit visible rows

    no prob.

  7. #7
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: MSHFlexGrid: Auto adjusting grid to fit visible rows

    Quote Originally Posted by randem
    I tried it, this works better for me
    vb Code:
    1. .Height = .RowHeight(Count - 1) * Count

    Why the arbitrary number 90????
    Don't know about the 90, it just works
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  8. #8

    Thread Starter
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    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...
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width