0

Created my own user control (height = about 40 - 45 px) and tried to arrange them to a (vertical) list in a Panel & FlowLayoutPanel (with autoscroll property enabled).. It works great and all with about 300 items....

The problem was when the item count reaches over 1000. Somewhere in the middle. The list ends, and the rest of the items get stacked for some reason but the scroll bar seems to calculate the total height and can be scrolled to the bottom with empty spaces.

EDIT:

On runtime after reading some files on a directory, it creates a userControl with the (music) file tags as labels then I add it to the list for viewing and selecting.

public void AddItemsFromDirectory(string directory)
{
    //Read files from directory
    //...
    //Put them on a List<T> files
    //...

    //Add them to the panel/flowLayoutPanel
    for(i = 0; i < files.Count; i++)
    {
        UserControlItem item = new UserControlItem(files[i]) //UserControlItem puts labels for the tags 
        {
            Location = new Point(0, UserControlItem.Height * i), //Height is constant
            //add some events for selecting
        };

        panel1.Controls.Add(item);
    }
}

Is there any simple way of overcoming this problem?

Sidenote:

Tried a different approach on this problem I am trying to make a custom list control that only shows them when they are next on the list and must be visible. Like showing only 7 items that fit in the panel and removing them from Controls when they are not visible. But it still doesn't work the best like my first idea

TweakBox
  • 53
  • 9
  • This sounds like a code issue. Can you provide the code used to put the controls into the panel? – Trisped Jun 10 '16 at 16:39
  • 2
    Standard bug is forgetting to use the AutoScrollPosition property when painting an item in the list. Required to properly offset the string by the scroll amount. This is not youtube.com, you do have to show your code here. – Hans Passant Jun 10 '16 at 16:46
  • Sounds like [Windows.Forms.Panel 32767 size limit](http://stackoverflow.com/questions/8064678/windows-forms-panel-32767-size-limit) issue – Ivan Stoev Jun 10 '16 at 17:04
  • edited it! would that info help? – TweakBox Jun 11 '16 at 02:22
  • #Ivan Stoev. Your question is what i originally thought about and the [answer](http://stackoverflow.com/a/33350605/6048581) is what i had in mind of solving my issue – TweakBox Jun 11 '16 at 02:37

0 Answers0