0

I have a secondary form with a docked FlowLayoutPanel that is dynamically populated with a number of DataGridViews. When there are a large number, around 100 or more, the vertical scroll will not display all the child controls. Sometimes they are cut off mid control. If I resize the window it will change the number of controls and how much of the last row of controls will be displayed, but not in any pattern I can recognize. When I maximize the form it is very likely to display all the child controls, but not guaranteed.

The closest I've found to this problem has recommended using SyspendLayout/ResumeLayout around the addition of the controls, but this has done nothing for me.

    private void PopulateDisplay()
    {
        previewFlow.SuspendLayout();
        foreach(DataGridView dgv in _Display)
        {
            previewFlow.Controls.Add(dgv);
        }
        previewFlow.ResumeLayout();
    }

_Display is List which I populate earlier via code. Each is populated by a SQL query that returns a different number of results.

I would like the form to show all the DataGridViews on any size form without having to worry that something is incomplete.

Red Gordon
  • 43
  • 9
  • You can't display anything beyond 32k pixels. If your DGVs are too large for the numbers you should redesign, e.g. by using virtual scrolling. See [here for an example](http://stackoverflow.com/questions/39808934/fake-scrolling-containers-with-very-many-controls/39810717?s=3|0.0000#39810717) – TaW Oct 11 '16 at 06:16
  • Thanks, I didn't know about the pixel limit; that is likely what I'm running into. I also didn't know about virtual scrolling, thanks for the lead. But if the area to be displayed is fixed, how come I can sometimes get more data than other times? – Red Gordon Oct 12 '16 at 16:26
  • You don't. But the DGVs may have different sizes, number of rows, fonts, margins etc. – TaW Oct 12 '16 at 17:08

0 Answers0