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